assertEquals(sampler.getMethod(), res.getHTTPMethod()); // Cannot check the query string of the result, because the mirror server // replies without including query string in URL String expectedQueryString = null; if(!valuesAlreadyUrlEncoded) { String expectedTitle = URLEncoder.encode(titleValue, contentEncoding); String expectedDescription = URLEncoder.encode(descriptionValue, contentEncoding); expectedQueryString = titleField + "=" + expectedTitle + "&" + descriptionField + "=" + expectedDescription; } else { expectedQueryString = titleField + "=" + titleValue + "&" + descriptionField + "=" + descriptionValue; }
assertEquals(sampler.getUrl(), res.getURL()); String expectedPostBody = null; if(!valuesAlreadyUrlEncoded) { String expectedTitle = URLEncoder.encode(titleValue, contentEncoding); String expectedDescription = URLEncoder.encode(descriptionValue, contentEncoding); expectedPostBody = titleField + "=" + expectedTitle + "&" + descriptionField + "=" + expectedDescription; } else { expectedPostBody = titleField + "=" + titleValue + "&" + descriptionField + "=" + descriptionValue; }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java
Method name: void checkGetRequest_Parameters(HTTPSamplerBase, HTTPSampleResult, String, URL, String, String, String, String, boolean) Method name: void checkPostRequestUrlEncoded(HTTPSamplerBase, HTTPSampleResult, String, String, String, String, String, String, boolean)
Number of AST nodes: 7 Number of AST nodes: 7
1
assertEquals(sampler.getMethod(), res.getHTTPMethod());
1
assertEquals(sampler.getUrl(), res.getURL());
2
        // Cannot check the query string of the result, because the mirror server
2
        
3
        // replies without including query string in URL
4
        
5
        String expectedQueryString = null;
3
String expectedPostBody = null;
6
        if(!valuesAlreadyUrlEncoded) {
4
        if(!valuesAlreadyUrlEncoded) {
7
            String expectedTitle = URLEncoder.encode(titleValue, contentEncoding);
5
            String expectedTitle = URLEncoder.encode(titleValue, contentEncoding);
8
            String expectedDescription = URLEncoder.encode(descriptionValue, contentEncoding);
6
            String expectedDescription = URLEncoder.encode(descriptionValue, contentEncoding);
9
            expectedQueryString = titleField + "=" + expectedTitle + "&" + descriptionField + "=" + expectedDescription;
7
            expectedPostBody = titleField + "=" + expectedTitle + "&" + descriptionField + "=" + expectedDescription;
10
        }
8
        }
11
        else {
9
        else {
12
            expectedQueryString = titleField + "=" + titleValue + "&" + descriptionField + "=" + descriptionValue;
10
            expectedPostBody = titleField + "=" + titleValue + "&" + descriptionField + "=" + descriptionValue;
13
        }
11
        }
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.3
Clones locationClones are declared in the same class
Number of node comparisons29
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)50.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    assertEquals(sampler.getMethod(), res.getHTTPMethod());
    4
    assertEquals(sampler.getMethod(), res.getHTTPMethod());
    3
    assertEquals(sampler.getUrl(), res.getURL());
    Differences
    Expression1Expression2Difference
    getMethodgetUrlMETHOD_INVOCATION_NAME_MISMATCH
    java.lang.Stringjava.net.URLVARIABLE_TYPE_MISMATCH
    getHTTPMethodgetURLMETHOD_INVOCATION_NAME_MISMATCH
    java.lang.Stringjava.net.URLVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable sampler.getMethod() does not match with type java.net.URL of variable sampler.getUrl()
    • Make classes java.lang.String and java.net.URL extend a common superclass
    Type java.lang.String of variable res.getHTTPMethod() does not match with type java.net.URL of variable res.getURL()
    • Make classes java.lang.String and java.net.URL extend a common superclass
    3
    assertEquals(sampler.getUrl(), res.getURL());
    5
    String expectedQueryString = null;
    5
    String expectedQueryString = null;
    4
    String expectedPostBody = null;
    Differences
    Expression1Expression2Difference
    expectedQueryStringexpectedPostBodyVARIABLE_NAME_MISMATCH
    4
    String expectedPostBody = null;
    6
    if (!valuesAlreadyUrlEncoded)
    5
    if (!valuesAlreadyUrlEncoded)
    7
    String expectedTitle = URLEncoder.encode(titleValue, contentEncoding);
    6
    String expectedTitle = URLEncoder.encode(titleValue, contentEncoding);
    8
    String expectedDescription = URLEncoder.encode(descriptionValue, contentEncoding);
    7
    String expectedDescription = URLEncoder.encode(descriptionValue, contentEncoding);
    9
    expectedQueryString = titleField + "=" + expectedTitle + "&" + descriptionField + "=" + expectedDescription;
    9
    expectedQueryString = titleField + "=" + expectedTitle + "&" + descriptionField + "=" + expectedDescription;
    8
    expectedPostBody = titleField + "=" + expectedTitle + "&" + descriptionField + "=" + expectedDescription;
    Differences
    Expression1Expression2Difference
    expectedQueryStringexpectedPostBodyVARIABLE_NAME_MISMATCH
    8
    expectedPostBody = titleField + "=" + expectedTitle + "&" + descriptionField + "=" + expectedDescription;
    else
    else
    10
    expectedQueryString = titleField + "=" + titleValue + "&" + descriptionField + "=" + descriptionValue;
    10
    expectedQueryString = titleField + "=" + titleValue + "&" + descriptionField + "=" + descriptionValue;
    9
    expectedPostBody = titleField + "=" + titleValue + "&" + descriptionField + "=" + descriptionValue;
    Differences
    Expression1Expression2Difference
    expectedQueryStringexpectedPostBodyVARIABLE_NAME_MISMATCH
    9
    expectedPostBody = titleField + "=" + titleValue + "&" + descriptionField + "=" + descriptionValue;
    Precondition Violations (2)
    Row Violation
    1Type java.lang.String of variable sampler.getMethod() does not match with type java.net.URL of variable sampler.getUrl()
    2Type java.lang.String of variable res.getHTTPMethod() does not match with type java.net.URL of variable res.getURL()