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: 6 | Number of AST nodes: 6 | |||
1 | while (tests.hasMoreElements()) {↵ | 1 | while (tests.hasMoreElements()) {↵ | |
2 | ↵ | |||
3 | Test t = (Test) tests.nextElement();↵ | 2 | Test t = (Test) tests.nextElement();↵ | |
4 | if (t instanceof TestCase) {↵ | 3 | if (t instanceof TestCase) {↵ | |
5 | ↵ | |||
6 | String name = ((TestCase) t).getName();↵ | 4 | String name = ((TestCase) t).getName();↵ | |
7 | ↵ | |||
8 | if (!failureExpected.contains(name + "FailureExpected")) {↵ | 5 | if (name.endsWith("FailureExpected"))↵ | |
9 | ↵ | |||
10 | result.addTest(t);↵ | 6 | ↵ | |
11 | }↵ | |||
12 | ↵ | 7 | failureExpected.add(name);↵ | |
13 | } ↵ | 8 | } ↵ | |
14 | ↵ | |||
15 | } | 9 | } | |
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 | 12 |
Number of mapped statements | 5 |
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) | 0.8 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
12 | while (tests.hasMoreElements()) | 4 | while (tests.hasMoreElements()) | |||||||||||||
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 |