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 | if (t instanceof TestCase) {↵ | 2 | if (t instanceof TestCase) { ↵ | |
3 | String name = ((TestCase) t).getName();↵ | 3 | String name = ((TestCase) t).getName(); ↵ | |
4 | if (name.endsWith("FailureExpected"))↵ | 4 | if (!failureExpected.contains(name + "FailureExpected")) { ↵ | |
5 | failureExpected.add(name);↵ | 5 | result.addTest(t);↵ | |
6 | } ↵ | |||
6 | } | 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.6 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 |