public static TestSuite createFailureExpectedSuite(Class testClass) { TestSuite allTests = new TestSuite(testClass); Set failureExpected = new HashSet(); Enumeration tests = allTests.tests(); while (tests.hasMoreElements()) { Test t = (Test) tests.nextElement(); if (t instanceof TestCase) { String name = ((TestCase) t).getName(); if (name.endsWith("FailureExpected")) failureExpected.add(name); } } TestSuite result = new TestSuite(); tests = allTests.tests(); while (tests.hasMoreElements()) { Test t = (Test) tests.nextElement(); if (t instanceof TestCase) { String name = ((TestCase) t).getName(); if (!failureExpected.contains(name + "FailureExpected")) { result.addTest(t); } } } return result;
public static TestSuite createFailureExpectedSuite(Class testClass) { TestSuite allTests = new TestSuite(testClass); Set failureExpected = new HashSet(); Enumeration tests = allTests.tests(); while (tests.hasMoreElements()) { Test t = (Test) tests.nextElement(); if (t instanceof TestCase) { String name = ((TestCase) t).getName(); if (name.endsWith("FailureExpected")) failureExpected.add(name); } } TestSuite result = new TestSuite(); tests = allTests.tests(); while (tests.hasMoreElements()) { Test t = (Test) tests.nextElement(); if (t instanceof TestCase) { String name = ((TestCase) t).getName(); if (!failureExpected.contains(name + "FailureExpected")) { result.addTest(t); } } } return result;
Clone fragments detected by clone detection tool
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: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public static TestSuite createFailureExpectedSuite(Class testClass) {
1
public static TestSuite createFailureExpectedSuite(Class testClass) {
2
       
3
    
2
	   
4
   TestSuite allTests = new TestSuite(testClass);
3
	   TestSuite allTests = new TestSuite(testClass);
5
       Set failureExpected = new HashSet();
4
       Set failureExpected = new HashSet();
6
    
7
   Enumeration tests = allTests.tests();
5
	   Enumeration tests = allTests.tests();
8
    
9
   while (tests.hasMoreElements()) {
6
	   while (tests.hasMoreElements()) {
10
 
11
         Test t = (Test) tests.nextElement();
7
	      Test t = (Test) tests.nextElement();
12
    
13
      if (t instanceof TestCase) {
8
	      if (t instanceof TestCase) {
14
   
15
          String name = ((TestCase) t).getName();
9
	         String name = ((TestCase) t).getName();
16
    
17
         if (name.endsWith("FailureExpected"))
10
	         if (name.endsWith("FailureExpected"))
18
    
19
            failureExpected.add(name);
11
	            failureExpected.add(name);
20
    
21
      }       
12
	      }	      
22
       }
23
       
24
    
13
	   }
14
	   
25
   TestSuite result = new TestSuite();
15
	   TestSuite result = new TestSuite();
26
       tests = allTests.tests();
16
       tests = allTests.tests();
27
       while (tests.hasMoreElements()) {
17
       while (tests.hasMoreElements()) {
28
          Test t = (Test) tests.nextElement();
18
          Test t = (Test) tests.nextElement();
29
          if (t instanceof TestCase) {
19
          if (t instanceof TestCase) {
30
             String name = ((TestCase) t).getName();
20
             String name = ((TestCase) t).getName();
31
             if (!failureExpected.contains(name + "FailureExpected")) {
21
             if (!failureExpected.contains(name + "FailureExpected")) {
32
                result.addTest(t);
22
                result.addTest(t);
33
             }
23
             }
34
          }       
24
          }       
35
       }
25
       }
36
       
37
    
26
	   
38
   return result;
27
	   return result;
39
    
28
	
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0