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/cache-jbosscache2/src/test/java/org/hibernate/test/util/CacheTestUtil.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 | Test t = (Test) tests.nextElement();↵ | 2 | Test t = (Test) tests.nextElement();↵ | |
3 | if (t instanceof TestCase) {↵ | 3 | if (t instanceof TestCase) {↵ | |
4 | String name = ((TestCase) t).getName();↵ | 4 | String name = ((TestCase) t).getName();↵ | |
5 | if (name.endsWith("FailureExpected"))↵ | 5 | if (!failureExpected.contains(name + "FailureExpected")) {↵ | |
6 | failureExpected.add(name);↵ | 6 | result.addTest(t);↵ | |
7 | }↵ | |||
7 | } ↵ | 8 | } ↵ | |
8 | } | 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 the same method |
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) | 1.8 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4 | while (tests.hasMoreElements()) | 12 | while (tests.hasMoreElements()) | |||||||||||||
5 | Test t = (Test)tests.nextElement(); | 13 | Test t = (Test)tests.nextElement(); | |||||||||||||
6 | if (t instanceof TestCase) | 14 | if (t instanceof TestCase) | |||||||||||||
7 | String name = ((TestCase)t).getName(); | 15 | String name = ((TestCase)t).getName(); | |||||||||||||
8 | if (name.endsWith("FailureExpected")) |
| 16 | if (!failureExpected.contains(name + "FailureExpected")) | ||||||||||||
9 | failureExpected.add(name); |
| | |||||||||||||
|
| 17 | result.addTest(t); |
Row | Violation |
---|---|
1 | Expression name.endsWith("FailureExpected") cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression !failureExpected.contains(name + "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 name with type java.lang.String , while Clone fragment #2 returns variable t with type junit.framework.Test |