try {
s.isSelected(basedir,filenames[0],files[0]);
fail("DepthSelector did not check for maximum being higher "
+ "than minimum");
} catch (BuildException be2) {
assertEquals("The maximum depth is lower than the minimum.",
be2.getMessage());
}
s = (DepthSelector)getInstance();
try {
s.isSelected(basedir,filenames[0],files[0]);
fail("DateSelector did not check for Datetime being in the "
+ "allowable range");
} catch (BuildException be2) {
assertEquals("Date of 01/01/1969 01:01 AM results in negative "
+ "milliseconds value relative to epoch (January 1, "
+ "1970, 00:00:00 GMT).", be2.getMessage());
}
s = (DateSelector)getInstance();
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/selectors/DepthSelectorTest.java
|
|
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/selectors/DateSelectorTest.java
|
Method name: void testValidate()
|
|
Method name: void testValidate()
|
Number of AST nodes: 4
|
|
Number of AST nodes: 4
|
|
1 | try {↵ | | 1 | try {↵
|
2 | s.isSelected(basedir,filenames[0],files[0]);↵ | | 2 | s.isSelected(basedir,filenames[0],files[0]);↵
|
3 | fail("DepthSelector did not check for maximum being higher "↵ | | 3 | fail("DateSelector did not check for Datetime being in the "↵
|
4 | + "than minimum");↵ | | 4 | + "allowable range");↵
|
5 | } catch (BuildException be2) {↵ | | 5 | } catch (BuildException be2) {↵
|
6 | assertEquals("The maximum depth is lower than the minimum.",↵ | | 6 | assertEquals("↵
|
7 | ↵ | | 7 | Date of 01/01/1969 01:01 AM results in negative "↵
|
| | | 8 | + "milliseconds value relative to epoch (January 1, "↵
|
8 | be2.getMessage());↵ | | 9 | + "1970, 00:00:00 GMT).", be2.getMessage());↵
|
9 | }↵ | | 10 | }↵
|
|
10 | s = (DepthSelector)getInstance(); | | 11 | s = (DateSelector)getInstance();
|
See real code fragment |
|
See real code fragment |
Summary
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.2 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 10 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 4 |
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) | 12.0 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
8 | try | | 7 | try |
9 | s.isSelected(basedir, filenames[0], files[0]); | | 8 | s.isSelected(basedir, filenames[0], files[0]); |
10 | fail("DepthSelector did not check for maximum being higher " + "than minimum"); | | 9 | fail("DateSelector did not check for Datetime being in the " + "allowable range"); |
11 | s = (DepthSelector)getInstance(); | | 10 | s = (DateSelector)getInstance(); |
Precondition Violations (1)
Row |
Violation |
1 | Clone fragment #1 returns variable s with type org.apache.tools.ant.types.selectors.DepthSelector , while Clone fragment #2 returns variable s with type org.apache.tools.ant.types.selectors.DateSelector |