File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/MapperTest.java | File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/MapperTest.java | |||
Method name: void testChained()
|
Method name: void testNested()
|
|||
Number of AST nodes: 8 | Number of AST nodes: 8 | |||
1 | chained.addConfiguredMapper(mapperCX);↵ | 1 | container.add(mapper3);↵ | |
2 | FileNameMapper fileNameMapper = chained.getImplementation();↵ | 2 | FileNameMapper fileNameMapper = container.getImplementation();↵ | |
3 | String[] targets = fileNameMapper.mapFileName("a");↵ | 3 | String[] targets = fileNameMapper.mapFileName("fromfilename");↵ | |
4 | assertNotNull("no filenames mapped", targets);↵ | 4 | assertNotNull("no filenames mapped", targets);↵ | |
5 | assertEquals("wrong number of filenames mapped", 2, targets.length);↵ | 5 | assertEquals("wrong number of filenames mapped", 3, targets.length);↵ | |
6 | List list = Arrays.asList(targets);↵ | 6 | List list = Arrays.asList(targets);↵ | |
7 | assertTrue("cannot find expected target \"def\"",↵ | 7 | assertTrue("cannot find expected target \"tofilename\"",↵ | |
8 | list.contains("def"));↵ | 8 | list.contains("tofilename"));↵ | |
9 | assertTrue("cannot find expected target \"ghi\"",↵ | 9 | assertTrue("cannot find expected target \"fromfilename\"",↵ | |
10 | list.contains("ghi")); | 10 | list.contains("fromfilename")); | |
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 | 40 |
Number of mapped statements | 7 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
| 13 | container.add(mapper3); | ||||||||||||||
20 | chained.addConfiguredMapper(mapperCX); |
| | ||||||||||||||
21 | FileNameMapper fileNameMapper = chained.getImplementation(); |
| 14 | FileNameMapper fileNameMapper = container.getImplementation(); | |||||||||||||
22 | String[] targets = fileNameMapper.mapFileName("a"); |
| 15 | String[] targets = fileNameMapper.mapFileName("fromfilename"); | |||||||||||||
23 | assertNotNull("no filenames mapped", targets); | 16 | assertNotNull("no filenames mapped", targets); | ||||||||||||||
24 | assertEquals("wrong number of filenames mapped", 2, targets.length); |
| 17 | assertEquals("wrong number of filenames mapped", 3, targets.length); | |||||||||||||
25 | List list = Arrays.asList(targets); | 18 | List list = Arrays.asList(targets); | ||||||||||||||
26 | assertTrue("cannot find expected target \"def\"", list.contains("def")); |
| 19 | assertTrue("cannot find expected target \"tofilename\"", list.contains("tofilename")); | |||||||||||||
27 | assertTrue("cannot find expected target \"ghi\"", list.contains("ghi")); |
| 20 | assertTrue("cannot find expected target \"fromfilename\"", list.contains("fromfilename")); |
Row | Violation |
---|---|
1 | Unmatched statement container.add(mapper3); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Unmatched statement chained.addConfiguredMapper(mapperCX); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
3 | Clone fragment #1 returns variables , while Clone fragment #2 returns variables list |