final CLOptionDescriptor[] options = new CLOptionDescriptor[] { ALL, TAINT }; final String[] args = new String[] { "-T", "-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(TAINT_OPT, option0.getDescriptor().getId()); assertEquals(null, option0.getArgument(0)); 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 testOptionalArgsNoArgShortBeforeOtherOpt() 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[] { "-T", "-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(TAINT_OPT, option0.getDescriptor().getId());
10
        assertEquals(null, option0.getArgument(0));
9
assertEquals(((CLOption) clOptions.get(1)).getDescriptor().getId(), CLEAR1_OPT);
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 statements10
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment2
    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[] {"-T", "-a"};
    2
    final String[] args = new String[] {"-T", "-a"};
    2
    final String[] args = new String[] {"-Dstupid=", "-c"};
    Differences
    Expression1Expression2Difference
    "-T""-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(TAINT_OPT, option0.getDescriptor().getId());
                                                                                                                          
    10
    assertEquals(null, option0.getArgument(0));
    10
    assertEquals(option.getDescriptor().getId(), DEFINE_OPT);
                                                                                                      
    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 variables option0, clOptions , while Clone fragment #2 returns variables option