final CLOptionDescriptor[] options = new CLOptionDescriptor[] { ALL, TAINT }; final String[] args = new String[] { "-T3", "-a" }; final CLArgsParser parser = new CLArgsParser(args, options); assertNull(parser.getErrorString(), parser.getErrorString()); final List clOptions = parser.getArguments(); final int size = clOptions.size(); assertEquals(size, 2); final CLOption option0 = (CLOption) clOptions.get(0); assertEquals(option0.getDescriptor().getId(), TAINT_OPT); assertEquals(option0.getArgument(0), "3"); final CLOption option1 = (CLOption) clOptions.get(1); assertEquals(ALL_OPT, option1.getDescriptor().getId()); assertEquals(null, option1.getArgument(0));
final CLOptionDescriptor[] options = new CLOptionDescriptor[] { DEFINE, CLEAR1 }; final String[] args = new String[] { "-Dstupid=", "-c" }; final CLArgsParser parser = new CLArgsParser(args, options); assertNull(parser.getErrorString(), parser.getErrorString()); final List clOptions = parser.getArguments(); final int size = clOptions.size(); assertEquals(size, 2); assertEquals(((CLOption) clOptions.get(1)).getDescriptor().getId(), CLEAR1_OPT); final CLOption option = (CLOption) clOptions.get(0); assertEquals(option.getDescriptor().getId(), DEFINE_OPT); assertEquals(option.getArgument(0), "stupid"); assertEquals(option.getArgument(1), "");
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/commons/cli/avalon/ClutilTestCase.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/commons/cli/avalon/ClutilTestCase.java
Method name: void testOptionalArgsWithArgShortBeforeOtherOpt() Method name: void testIncomplete2ArgsMixed()
Number of AST nodes: 13 Number of AST nodes: 12
1
final CLOptionDescriptor[] options = new CLOptionDescriptor[] { ALL, TAINT };
1
final CLOptionDescriptor[] options = new CLOptionDescriptor[] { DEFINE, CLEAR1 };
2
        final String[] args = new String[] { "-T3", "-a" };
2
        final String[] args = new String[] { "-Dstupid=", "-c" };
3
        final CLArgsParser parser = new CLArgsParser(args, options);
3
        final CLArgsParser parser = new CLArgsParser(args, options);
4
        assertNull(parser.getErrorString(), parser.getErrorString());
4
        assertNull(parser.getErrorString(), parser.getErrorString());
5
        final List clOptions = parser.getArguments();
5
        final List clOptions = parser.getArguments();
6
        final int size = clOptions.size();
6
        final int size = clOptions.size();
7
        assertEquals(size, 2);
7
        assertEquals(size, 2);
8
        final CLOption option0 = (CLOption) clOptions.get(0);
8
        
9
        assertEquals(option0.getDescriptor().getId(), TAINT_OPT);
9
assertEquals(((CLOption) clOptions.get(1)).getDescriptor().getId(), CLEAR1_OPT);
10
        assertEquals(option0.getArgument(0), "3");
11
        final CLOption option1 = (CLOption) clOptions.get(1);
10
        final CLOption option = (CLOption) clOptions.get(0);
12
        assertEquals(ALL_OPT, option1.getDescriptor().getId());
11
        assertEquals(option.getDescriptor().getId(), DEFINE_OPT);
13
        assertEquals(null, 
12
        assertEquals(option.getArgument(0), "stupid");
14
option1.getArgument(0));
13
        assertEquals(option.getArgument(1), "");
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are declared in the same class
Number of node comparisons133
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    final CLOptionDescriptor[] options = new CLOptionDescriptor[] {ALL, TAINT};
    1
    final CLOptionDescriptor[] options = new CLOptionDescriptor[] {ALL, TAINT};
    1
    final CLOptionDescriptor[] options = new CLOptionDescriptor[] {DEFINE, CLEAR1};
    Differences
    Expression1Expression2Difference
    ALLDEFINEVARIABLE_NAME_MISMATCH
    TAINTCLEAR1VARIABLE_NAME_MISMATCH
    1
    final CLOptionDescriptor[] options = new CLOptionDescriptor[] {DEFINE, CLEAR1};
    2
    final String[] args = new String[] {"-T3", "-a"};
    2
    final String[] args = new String[] {"-T3", "-a"};
    2
    final String[] args = new String[] {"-Dstupid=", "-c"};
    Differences
    Expression1Expression2Difference
    "-T3""-Dstupid="LITERAL_VALUE_MISMATCH
    "-a""-c"LITERAL_VALUE_MISMATCH
    2
    final String[] args = new String[] {"-Dstupid=", "-c"};
    3
    final CLArgsParser parser = new CLArgsParser(args, options);
    3
    final CLArgsParser parser = new CLArgsParser(args, options);
    4
    assertNull(parser.getErrorString(), parser.getErrorString());
    4
    assertNull(parser.getErrorString(), parser.getErrorString());
    5
    final List clOptions = parser.getArguments();
    5
    final List clOptions = parser.getArguments();
    6
    final int size = clOptions.size();
    6
    final int size = clOptions.size();
    7
    assertEquals(size, 2);
    7
    assertEquals(size, 2);
    8
    final CLOption option0 = (CLOption)clOptions.get(0);
    8
    final CLOption option0 = (CLOption)clOptions.get(0);
    9
    final CLOption option = (CLOption)clOptions.get(0);
    Differences
    Expression1Expression2Difference
    option0optionVARIABLE_NAME_MISMATCH
    9
    final CLOption option = (CLOption)clOptions.get(0);
    9
    assertEquals(option0.getDescriptor().getId(), TAINT_OPT);
    9
    assertEquals(option0.getDescriptor().getId(), TAINT_OPT);
    10
    assertEquals(option.getDescriptor().getId(), DEFINE_OPT);
    Differences
    Expression1Expression2Difference
    option0optionVARIABLE_NAME_MISMATCH
    TAINT_OPTDEFINE_OPTVARIABLE_NAME_MISMATCH
    10
    assertEquals(option.getDescriptor().getId(), DEFINE_OPT);
    10
    assertEquals(option0.getArgument(0), "3");
    10
    assertEquals(option0.getArgument(0), "3");
    11
    assertEquals(option.getArgument(0), "stupid");
    Differences
    Expression1Expression2Difference
    option0optionVARIABLE_NAME_MISMATCH
    "3""stupid"LITERAL_VALUE_MISMATCH
    11
    assertEquals(option.getArgument(0), "stupid");
    11
    final CLOption option1 = (CLOption)clOptions.get(1);
    11
    final CLOption option1 = (CLOption)clOptions.get(1);
    Preondition Violations
    Unmatched statement final CLOption option1=(CLOption)clOptions.get(1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                
                                                                                          
    12
    assertEquals(option.getArgument(1), "");
    12
    assertEquals(ALL_OPT, option1.getDescriptor().getId());
                                                                                                                        
    13
    assertEquals(null, option1.getArgument(0));
    8
    assertEquals(((CLOption)clOptions.get(1)).getDescriptor().getId(), CLEAR1_OPT);
    Precondition Violations (2)
    Row Violation
    1Unmatched statement final CLOption option1=(CLOption)clOptions.get(1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Clone fragment #1 returns variable clOptions with type java.util.List , while Clone fragment #2 returns variable option with type org.apache.commons.cli.avalon.CLOption