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 testIncomplete2ArgsMixedNoEq()
|
|||
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), ""); | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 133 |
Number of mapped statements | 11 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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); |
| 9 | final CLOption option = (CLOption)clOptions.get(0); | |||||||||||||
9 | assertEquals(option0.getDescriptor().getId(), TAINT_OPT); |
| 10 | assertEquals(option.getDescriptor().getId(), DEFINE_OPT); | |||||||||||||
10 | assertEquals(option0.getArgument(0), "3"); |
| 11 | assertEquals(option.getArgument(0), "Stupid"); | |||||||||||||
11 | final CLOption option1 = (CLOption)clOptions.get(1); |
| | ||||||||||||||
| 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); |
Row | Violation |
---|---|
1 | 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 |
2 | Clone 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 |