File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/test/java/org/hibernate/test/util/CacheTestUtil.java | File path: /hibernate-distribution-3.3.2.GA/project/testing/src/main/java/org/hibernate/junit/UnitTestCase.java | |||
Method name: TestSuite createFailureExpectedSuite(Class)
|
Method name: TestSuite createFailureExpectedSuite(Class)
|
|||
Number of AST nodes: 5 | Number of AST nodes: 5 | |||
1 | Test t = (Test) tests.nextElement();↵ | 1 | Test t = (Test) tests.nextElement();↵ | |
2 | ↵ | |||
3 | if (t instanceof TestCase) {↵ | 2 | if (t instanceof TestCase) {↵ | |
4 | ↵ | |||
5 | String name = ((TestCase) t).getName();↵ | 3 | String name = ((TestCase) t).getName();↵ | |
6 | if (!failureExpected.contains(name + "FailureExpected")) {↵ | 4 | if (name.endsWith("FailureExpected"))↵ | |
7 | result.addTest(t);↵ | 5 | ↵ | |
8 | }↵ | |||
9 | ↵ | 6 | failureExpected.add(name);↵ | |
10 | } | 7 | } | |
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.2 |
Clones location | Clones are in different classes |
Number of node comparisons | 10 |
Number of mapped statements | 4 |
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) | 1.5 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
13 | Test t = (Test)tests.nextElement(); | 5 | Test t = (Test)tests.nextElement(); | |||||||||||||
14 | if (t instanceof TestCase) | 6 | if (t instanceof TestCase) | |||||||||||||
15 | String name = ((TestCase)t).getName(); | 7 | String name = ((TestCase)t).getName(); | |||||||||||||
16 | if (!failureExpected.contains(name + "FailureExpected")) |
| 8 | if (name.endsWith("FailureExpected")) | ||||||||||||
|
| 9 | failureExpected.add(name); | |||||||||||||
17 | result.addTest(t); |
| |
Row | Violation |
---|---|
1 | Expression !failureExpected.contains(name + "FailureExpected") cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression name.endsWith("FailureExpected") cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement failureExpected.add(name); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement result.addTest(t); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Clone fragment #1 returns variable t with type junit.framework.Test , while Clone fragment #2 returns variable name with type java.lang.String |