TestElement element = (TestElement) testBeanClass.newInstance(); // configure(element); // super.clear(); // set name, enabled. modifyTestElement(element); // put the default values back into the // new element return element;
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/testbeans/gui/TestBeanGUI.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/control/TestThroughputController.java
Method name: TestElement createTestElement() Method name: void testByNumber()
Number of AST nodes: 3 Number of AST nodes: 4
1
TestElement element = (TestElement) testBeanClass.newInstance();
2
			// configure(element);
3
			// super.clear(); // set name, enabled.
4
			modifyTestElement(element); // put the default values back into the
5
			// new element
6
			return element;
1
for (int counter = 0; counter < order.length; counter++) {
2
				TestElement sampler = test.next();
3
				assertNotNull(sampler);
4
				assertEquals("Counter: " + counter, order[counter], sampler.getName());
5
			}
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 comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    TestElement element = (TestElement)testBeanClass.newInstance();
    2
    TestElement element = (TestElement)testBeanClass.newInstance();
    22
    TestElement sampler = test.next();
    Differences
    Expression1Expression2Difference
    elementsamplerVARIABLE_NAME_MISMATCH
    org.apache.jmeter.testelement.TestElementorg.apache.jmeter.samplers.SamplerSUBCLASS_TYPE_MISMATCH
    (TestElement)testBeanClass.newInstance()test.next()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression (TestElement)testBeanClass.newInstance() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression test.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    22
    TestElement sampler = test.next();
                                                          
    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);
    3
    modifyTestElement(element);
    3
    modifyTestElement(element);
    24
    assertEquals("Counter: " + counter, order[counter], sampler.getName());
    Differences
    Expression1Expression2Difference
    modifyTestElementassertEqualsMETHOD_INVOCATION_NAME_MISMATCH
    modifyTestElement(element)assertEquals("Counter: " + counter,order[counter],sampler.getName())TYPE_COMPATIBLE_REPLACEMENT
    modifyTestElement(element)assertEquals("Counter: " + counter,order[counter],sampler.getName())ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression modifyTestElement(element) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertEquals("Counter: " + counter,order[counter],sampler.getName()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression modifyTestElement(element) is a void method call, and thus it cannot be parameterized
    Expression assertEquals("Counter: " + counter,order[counter],sampler.getName()) is a void method call, and thus it cannot be parameterized
    Expression modifyTestElement(element) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertEquals("Counter: " + counter,order[counter],sampler.getName()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression modifyTestElement(element) is a void method call, and thus it cannot be parameterized
    Expression assertEquals("Counter: " + counter,order[counter],sampler.getName()) is a void method call, and thus it cannot be parameterized
    24
    assertEquals("Counter: " + counter, order[counter], sampler.getName());
    4
    return element;
    4
    return element;
    Preondition Violations
    Unmatched statement return element; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return element;
                                        
    Precondition Violations (14)
    Row Violation
    1Expression (TestElement)testBeanClass.newInstance() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression test.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement assertNotNull(sampler); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Expression modifyTestElement(element) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression assertEquals("Counter: " + counter,order[counter],sampler.getName()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression modifyTestElement(element) is a void method call, and thus it cannot be parameterized
    7Expression assertEquals("Counter: " + counter,order[counter],sampler.getName()) is a void method call, and thus it cannot be parameterized
    8Expression modifyTestElement(element) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression assertEquals("Counter: " + counter,order[counter],sampler.getName()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression modifyTestElement(element) is a void method call, and thus it cannot be parameterized
    11Expression assertEquals("Counter: " + counter,order[counter],sampler.getName()) is a void method call, and thus it cannot be parameterized
    12Unmatched statement return element; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    13Unmatched return element;
    14The refactoring of the clones is infeasible, because classes org.apache.jmeter.testbeans.gui.TestBeanGUI and org.apache.jmeter.control.TestThroughputController do not have a common superclass