File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/selectors/ContainsSelectorTest.java | File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/selectors/DepthSelectorTest.java | |||
Method name: void testValidate()
|
Method name: void testValidate()
|
|||
Number of AST nodes: 5 | Number of AST nodes: 5 | |||
1 | ContainsSelector s = (ContainsSelector)getInstance();↵ | 1 | DepthSelector s = (DepthSelector)getInstance();↵ | |
2 | try {↵ | 2 | try {↵ | |
3 | s.isSelected(basedir,filenames[0],files[0]);↵ | 3 | s.isSelected(basedir,filenames[0],files[0]);↵ | |
4 | fail("ContainsSelector did not check for required field 'text'");↵ | 4 | fail("DepthSelector did not check for required fields");↵ | |
5 | } catch (BuildException be1) {↵ | 5 | } catch (BuildException be1) {↵ | |
6 | assertEquals("The text attribute is required↵ | 6 | assertEquals("You must set at least one of the min or the " +↵ | |
7 | ", be1.getMessage());↵ | 7 | "max levels.", be1.getMessage());↵ | |
8 | }↵ | 8 | }↵ | |
9 | s = (ContainsSelector)getInstance(); | 9 | s = (DepthSelector)getInstance(); | |
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.3 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 13 |
Number of mapped statements | 5 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 16.2 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | ContainsSelector s = (ContainsSelector)getInstance(); |
| 1 | DepthSelector s = (DepthSelector)getInstance(); | ||||||||||||||||
2 | try |
| 2 | try | ||||||||||||||||
3 | s.isSelected(basedir, filenames[0], files[0]); |
| 3 | s.isSelected(basedir, filenames[0], files[0]); | ||||||||||||||||
4 | fail("ContainsSelector did not check for required field 'text'"); |
| 4 | fail("DepthSelector did not check for required fields"); | ||||||||||||||||
5 | s = (ContainsSelector)getInstance(); |
| 5 | s = (DepthSelector)getInstance(); |
Row | Violation |
---|---|
1 | Clone fragment #1 returns variable s with type org.apache.tools.ant.types.selectors.ContainsSelector , while Clone fragment #2 returns variable s with type org.apache.tools.ant.types.selectors.DepthSelector |