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());
}
try {
f.setSrc(new File("example.zip"));
fail("can add src to "
+ f.getDataTypeName()
+ " when a dir 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/TarFileSetTest.java
|
|
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/ZipFileSetTest.java
|
Method name: void testAttributes()
|
|
Method name: void testAttributes()
|
Number of AST nodes: 3
|
|
Number of AST nodes: 3
|
|
1 | try {↵ | | 1 | try {↵
|
2 | f.setDir(new File("examples"));↵ | | 2 | f.setSrc(new File("example.zip"));↵
|
3 | fail("can add dir to "↵ | | 3 | fail("can add src to "↵
|
4 | + f.getDataTypeName()↵ | | 4 | + f.getDataTypeName()↵
|
5 | + " when a src is already present");↵ | | 5 | + " when a dir is already present");↵
|
6 | } catch (BuildException be) {↵ | | 6 | } catch (BuildException be) {↵
|
7 | assertEquals("Cannot set both dir and src attributes",be.getMessage());↵ | | 7 | assertEquals("Cannot set both dir and src attributes",be.getMessage());↵
|
8 | } | | 8 | }
|
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 | 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) | 33.5 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
3 | try | | 8 | try |
4 | f.setDir(new File("examples")); | | 9 | f.setSrc(new File("example.zip")); |
5 | fail("can add dir to " + f.getDataTypeName() + " when a src is already present"); | | 10 | fail("can add src to " + f.getDataTypeName() + " when a dir is already present"); |
Precondition Violations (4)
Row |
Violation |
1 | Expression f.setDir(new File("examples")) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression f.setSrc(new File("example.zip")) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression f.setDir(new File("examples")) is a void method call, and thus it cannot be parameterized |
4 | Expression f.setSrc(new File("example.zip")) is a void method call, and thus it cannot be parameterized |