try {
f.setRefid(new Reference("dummyref"));
fail("Can add reference to "
+ f.getDataTypeName()
+ " with nested patternset element.");
} catch (BuildException be) {
assertEquals("You must not specify nested elements when "
+ "using refid", be.getMessage());
}
try {
f.setDir(new File("examples"));
fail("can add dir to "
+ f.getDataTypeName()
+ " when a src is already present");
} catch (BuildException be) {
assertEquals("Cannot set both dir and src attributes",be.getMessage());
}
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/AbstractFileSetTest.java
|
|
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/ZipFileSetTest.java
|
Method name: void testEmptyElementIfIsReference()
|
|
Method name: void testAttributes()
|
Number of AST nodes: 3
|
|
Number of AST nodes: 3
|
|
1 | try {↵ | | 1 | try {↵
|
2 | f.setRefid(new Reference("dummyref"));↵ | | 2 | f.setDir(new File("examples"));↵
|
3 | fail("Can add reference to "↵ | | 3 | fail("can add dir to "↵
|
4 | + f.getDataTypeName()↵ | | 4 | + f.getDataTypeName()↵
|
5 | + " with nested patternset element.");↵ | | 5 | + " when a src is already present");↵
|
6 | } catch (BuildException be) {↵ | | 6 | } catch (BuildException be) {↵
|
7 | assertEquals("You must not specify nested elements when "↵ | | 7 | assertEquals("Cannot set bot↵
|
8 | + "using refid", be.getMessage());↵ | | 8 | h dir and src attributes",be.getMessage());↵
|
9 | } | | 9 | }
|
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.3 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 9 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 3 |
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) | 68.6 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
8 | try | | 3 | try |
9 | f.setRefid(new Reference("dummyref")); | | 4 | f.setDir(new File("examples")); |
10 | fail("Can add reference to " + f.getDataTypeName() + " with nested patternset element."); | | 5 | fail("can add dir to " + f.getDataTypeName() + " when a src is already present"); |
Precondition Violations (5)
Row |
Violation |
1 | Type org.apache.tools.ant.types.Reference does not match with type java.io.File |
2 | Expression f.setRefid(new Reference("dummyref")) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression f.setDir(new File("examples")) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression f.setRefid(new Reference("dummyref")) is a void method call, and thus it cannot be parameterized |
5 | Expression f.setDir(new File("examples")) is a void method call, and thus it cannot be parameterized |