BSFTestElement o = (BSFTestElement) super.clone(); o.init(); return o;
for (int counter = 0; counter < order.length; counter++) { TestElement sampler = test.next(); assertNotNull(sampler); assertEquals("Counter: " + counter, order[counter], sampler.getName()); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/util/BSFTestElement.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/control/TestThroughputController.java
Method name: Object clone() Method name: void testByNumber()
Number of AST nodes: 3 Number of AST nodes: 4
1
BSFTestElement o = (BSF
1
for (int counter = 0; counter < order.length; counter++) {
2
TestElement) super.clone();
2
				TestElement s
3
        o.init();
4
       return o;
3
ampler = test.next();
4
				assertNotNull(sampler);
5
				assertEquals("Counter: " + counter, order[counter], sampler.getName());
6
			}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are in different classes
Number of node comparisons7
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    BSFTestElement o = (BSFTestElement)super.clone();
    1
    BSFTestElement o = (BSFTestElement)super.clone();
    22
    TestElement sampler = test.next();
    Differences
    Expression1Expression2Difference
    org.apache.jmeter.util.BSFTestElementorg.apache.jmeter.testelement.TestElementSUBCLASS_TYPE_MISMATCH
    osamplerVARIABLE_NAME_MISMATCH
    org.apache.jmeter.util.BSFTestElementorg.apache.jmeter.testelement.TestElementSUBCLASS_TYPE_MISMATCH
    org.apache.jmeter.util.BSFTestElementorg.apache.jmeter.samplers.SamplerSUBCLASS_TYPE_MISMATCH
    (BSFTestElement)super.clone()test.next()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression test.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Super method call BSFTestElement o=(BSFTestElement)super.clone(); cannot be extracted from method
    22
    TestElement sampler = test.next();
    2
    o.init();
    2
    o.init();
    Preondition Violations
    Unmatched statement o.init(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                            
    3
    return o;
    3
    return o;
    Preondition Violations
    Unmatched statement return o; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return o;
                            
                                                          
    23
    assertNotNull(sampler);
    Preondition Violations
    Unmatched statement assertNotNull(sampler); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    23
    assertNotNull(sampler);
                                                                                                                                                      
    24
    assertEquals("Counter: " + counter, order[counter], sampler.getName());
    Preondition Violations
    Unmatched statement assertEquals("Counter: " + counter,order[counter],sampler.getName()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    24
    assertEquals("Counter: " + counter, order[counter], sampler.getName());
    Precondition Violations (9)
    Row Violation
    1Expression test.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Super method call BSFTestElement o=(BSFTestElement)super.clone(); cannot be extracted from method
    3Unmatched statement o.init(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement return o; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched return o;
    6Unmatched statement assertNotNull(sampler); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement assertEquals("Counter: " + counter,order[counter],sampler.getName()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Clone fragment #1 returns variable o with type org.apache.jmeter.util.BSFTestElement , while Clone fragment #2 returns variable sampler with type org.apache.jmeter.testelement.TestElement
    9The refactoring of the clones is infeasible, because classes org.apache.jmeter.util.BSFTestElement and org.apache.jmeter.control.TestThroughputController do not have a common superclass