HTTPSamplerBase sampler = new HTTPNullSampler(); sampler.setProtocol("http"); sampler.setMethod(HTTPSamplerBase.GET); sampler.setPath("/index.html?pear"); sampler.setDomain("www.apache.org"); assertEquals("http://www.apache.org/index.html?pear", sampler.getUrl().toString());
SampleResult res = new SampleResult(); res.sampleStart(); res.setBytes(100); res.setSampleLabel("sample of size 100 bytes"); res.sampleEnd(); assertEquals(100, res.getBytes()); assertEquals("sample of size 100 bytes", res.getSampleLabel());
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplers.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/samplers/TestSampleResult.java
Method name: void testArgumentWithoutEquals() Method name: void testByteCount()
Number of AST nodes: 6 Number of AST nodes: 7
1
HTTPSamplerBase sampler = new HTTPNullSampler();
1
Sample
2
            sampler.setProtocol("http"
2
Result res = new SampleResult();
3
            
3
);
4
            res.sampleStart();
4
            sampler.setMethod(HTTPSamplerBase.GET);
5
            res.setBytes(100);
5
            sampler.setPath("/index.html?pear");
6
            res.setSampleLabel("sample of size 100 bytes");
6
            sampler.setDomain("www.apache.org");
7
            res.sample
7
            assertEquals("http://www.apache.org/index.html?pear", sampler.getUrl().toString
8
End();
9
            assertEquals(100, res.getBytes());
8
());
10
            assertEquals("sample of size 100 bytes", res.getSampleLabel());
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 having the same super class
Number of node comparisons42
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                  
    1
    SampleResult res = new SampleResult();
    1
    HTTPSamplerBase sampler = new HTTPNullSampler();
                                                                                                      
                                              
    2
    res.sampleStart();
                                              
    3
    res.setBytes(100);
                                                                                                        
    4
    res.setSampleLabel("sample of size 100 bytes");
    2
    sampler.setProtocol("http");
    2
    sampler.setProtocol("http");
    7
    assertEquals("sample of size 100 bytes", res.getSampleLabel());
    Differences
    Expression1Expression2Difference
    setProtocolassertEqualsMETHOD_INVOCATION_NAME_MISMATCH
    sampler.setProtocol("http")assertEquals("sample of size 100 bytes",res.getSampleLabel())ARGUMENT_NUMBER_MISMATCH
    samplerMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression sampler.setProtocol("http") is a void method call, and thus it cannot be parameterized
    Expression assertEquals("sample of size 100 bytes",res.getSampleLabel()) is a void method call, and thus it cannot be parameterized
    Expression sampler.setProtocol("http") is a void method call, and thus it cannot be parameterized
    Expression assertEquals("sample of size 100 bytes",res.getSampleLabel()) is a void method call, and thus it cannot be parameterized
    7
    assertEquals("sample of size 100 bytes", res.getSampleLabel());
    3
    sampler.setMethod(HTTPSamplerBase.GET);
    3
    sampler.setMethod(HTTPSamplerBase.GET);
    6
    assertEquals(100, res.getBytes());
    Differences
    Expression1Expression2Difference
    setMethodassertEqualsMETHOD_INVOCATION_NAME_MISMATCH
    sampler.setMethod(HTTPSamplerBase.GET)assertEquals(100,res.getBytes())ARGUMENT_NUMBER_MISMATCH
    samplerMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression sampler.setMethod(HTTPSamplerBase.GET) is a void method call, and thus it cannot be parameterized
    Expression assertEquals(100,res.getBytes()) is a void method call, and thus it cannot be parameterized
    Expression sampler.setMethod(HTTPSamplerBase.GET) is a void method call, and thus it cannot be parameterized
    Expression assertEquals(100,res.getBytes()) is a void method call, and thus it cannot be parameterized
    6
    assertEquals(100, res.getBytes());
    4
    sampler.setPath("/index.html?pear");
                                                                                  
    5
    sampler.setDomain("www.apache.org");
                                                                                  
    6
    assertEquals("http://www.apache.org/index.html?pear", sampler.getUrl().toString());
    6
    assertEquals("http://www.apache.org/index.html?pear", sampler.getUrl().toString());
    5
    res.sampleEnd();
    Differences
    Expression1Expression2Difference
    assertEqualssampleEndMETHOD_INVOCATION_NAME_MISMATCH
    assertEquals("http://www.apache.org/index.html?pear",sampler.getUrl().toString())res.sampleEnd()ARGUMENT_NUMBER_MISMATCH
    resMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression assertEquals("http://www.apache.org/index.html?pear",sampler.getUrl().toString()) is a void method call, and thus it cannot be parameterized
    Expression res.sampleEnd() is a void method call, and thus it cannot be parameterized
    Expression assertEquals("http://www.apache.org/index.html?pear",sampler.getUrl().toString()) is a void method call, and thus it cannot be parameterized
    Expression res.sampleEnd() is a void method call, and thus it cannot be parameterized
    5
    res.sampleEnd();
    Precondition Violations (12)
    Row Violation
    1Expression sampler.setProtocol("http") is a void method call, and thus it cannot be parameterized
    2Expression assertEquals("sample of size 100 bytes",res.getSampleLabel()) is a void method call, and thus it cannot be parameterized
    3Expression sampler.setProtocol("http") is a void method call, and thus it cannot be parameterized
    4Expression assertEquals("sample of size 100 bytes",res.getSampleLabel()) is a void method call, and thus it cannot be parameterized
    5Expression sampler.setMethod(HTTPSamplerBase.GET) is a void method call, and thus it cannot be parameterized
    6Expression assertEquals(100,res.getBytes()) is a void method call, and thus it cannot be parameterized
    7Expression sampler.setMethod(HTTPSamplerBase.GET) is a void method call, and thus it cannot be parameterized
    8Expression assertEquals(100,res.getBytes()) is a void method call, and thus it cannot be parameterized
    9Expression assertEquals("http://www.apache.org/index.html?pear",sampler.getUrl().toString()) is a void method call, and thus it cannot be parameterized
    10Expression res.sampleEnd() is a void method call, and thus it cannot be parameterized
    11Expression assertEquals("http://www.apache.org/index.html?pear",sampler.getUrl().toString()) is a void method call, and thus it cannot be parameterized
    12Expression res.sampleEnd() is a void method call, and thus it cannot be parameterized