HTTPSamplerBase sampler = HTTPSamplerFactory.newInstance();// create default sampler modifyTestElement(sampler); return sampler;
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/protocol/http/control/gui/HttpTestSampleGui.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
HTTPSamplerBase sampler = HTTPSamplerFactory.newInstance();// create default sampler
1
for (int counter = 0; counter < order.length; counter++) {
2
				TestElement sampler = test.next();
2
		modifyTestElement(sampler);
3
				assertNotNull(sampler);
3
		return 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 comparisons9
  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
    1
    HTTPSamplerBase sampler = HTTPSamplerFactory.newInstance();
    1
    HTTPSamplerBase sampler = HTTPSamplerFactory.newInstance();
    22
    TestElement sampler = test.next();
    Differences
    Expression1Expression2Difference
    org.apache.jmeter.protocol.http.sampler.HTTPSamplerBaseorg.apache.jmeter.testelement.TestElementSUBCLASS_TYPE_MISMATCH
    org.apache.jmeter.protocol.http.sampler.HTTPSamplerBaseorg.apache.jmeter.testelement.TestElementSUBCLASS_TYPE_MISMATCH
    HTTPSamplerFactory.newInstance()test.next()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression test.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    22
    TestElement sampler = test.next();
    2
    modifyTestElement(sampler);
    2
    modifyTestElement(sampler);
    23
    assertNotNull(sampler);
    Differences
    Expression1Expression2Difference
    org.apache.jmeter.protocol.http.sampler.HTTPSamplerBaseorg.apache.jmeter.testelement.TestElementSUBCLASS_TYPE_MISMATCH
    modifyTestElementassertNotNullMETHOD_INVOCATION_NAME_MISMATCH
    modifyTestElement(sampler)assertNotNull(sampler)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression modifyTestElement(sampler) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertNotNull(sampler) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression modifyTestElement(sampler) is a void method call, and thus it cannot be parameterized
    Expression assertNotNull(sampler) is a void method call, and thus it cannot be parameterized
    Expression modifyTestElement(sampler) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertNotNull(sampler) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression modifyTestElement(sampler) is a void method call, and thus it cannot be parameterized
    Expression assertNotNull(sampler) is a void method call, and thus it cannot be parameterized
    23
    assertNotNull(sampler);
    3
    return sampler;
    3
    return sampler;
    Preondition Violations
    Unmatched statement return sampler; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return 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 (14)
    Row Violation
    1Expression test.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression modifyTestElement(sampler) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression assertNotNull(sampler) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression modifyTestElement(sampler) is a void method call, and thus it cannot be parameterized
    5Expression assertNotNull(sampler) is a void method call, and thus it cannot be parameterized
    6Expression modifyTestElement(sampler) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression assertNotNull(sampler) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression modifyTestElement(sampler) is a void method call, and thus it cannot be parameterized
    9Expression assertNotNull(sampler) is a void method call, and thus it cannot be parameterized
    10Unmatched statement return sampler; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    11Unmatched return sampler;
    12Unmatched 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
    13Clone fragment #1 returns variable sampler with type org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase , while Clone fragment #2 returns variable sampler with type org.apache.jmeter.testelement.TestElement
    14The refactoring of the clones is infeasible, because classes org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui and org.apache.jmeter.control.TestThroughputController do not have a common superclass