checkContentLength(connection, expectedUrl.length); checkArraysHaveSameContent(expectedUrl, connection.getOutputStreamContent()); assertEquals( URLDecoder.decode(new String(expectedUrl, "US-ASCII"), contentEncoding), URLDecoder.decode(new String(connection.getOutputStreamContent(), "US-ASCII"), contentEncoding)); connection.disconnect();
checkContentLength(connection, expectedUrl.length); checkArraysHaveSameContent(expectedUrl, connection.getOutputStreamContent()); assertEquals( URLDecoder.decode(new String(expectedUrl, "US-ASCII"), "ISO-8859-1"), // HTTPSampler uses ISO-8859-1 as default encoding URLDecoder.decode(new String(connection.getOutputStreamContent(), "US-ASCII"), "ISO-8859-1")); // HTTPSampler uses ISO-8859-1 as default encoding connection.disconnect();
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/sampler/PostWriterTest.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/sampler/PostWriterTest.java
Method name: void testSendFormData_Urlencoded() Method name: void testSendFormData_Urlencoded()
Number of AST nodes: 4 Number of AST nodes: 4
1
checkContentLength(connection, expectedUrl.length);
1
checkContentLength(connection, expectedUrl.length);
2
        checkArraysHaveSameContent(expectedUrl, connection.getOutputStreamContent());
2
        checkArraysHaveSameContent(expectedUrl, connection.getOutputStreamContent());
3
        assertEquals(
3
        assertEquals(
4
                URLDecoder.decode(new String(expectedUrl, "US-ASCII"), contentEncoding), 
4
                URLDecoder.decode(new String(expectedUrl, "US-ASCII"), "ISO-8859-1"), // HTTPSampler uses ISO-8859-1 as default encoding
5
                URLDecoder.decode(new String(connection.getOutputStreamContent(), "US-ASCII"), contentEncoding)); 
5
                URLDecoder.decode(new String(connection.getOutputStreamContent(), "US-ASCII"), "ISO-8859-1")); // HTTPSampler uses ISO-8859-1 as default encoding
6
        connection.disconnect();
6
        connection.disconnect();
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are in the same method
Number of node comparisons16
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    54
    checkContentLength(connection, expectedUrl.length);
    86
    checkContentLength(connection, expectedUrl.length);
    55
    checkArraysHaveSameContent(expectedUrl, connection.getOutputStreamContent());
    87
    checkArraysHaveSameContent(expectedUrl, connection.getOutputStreamContent());
    56
    assertEquals(URLDecoder.decode(new String(expectedUrl, "US-ASCII"), contentEncoding), URLDecoder.decode(new String(connection.getOutputStreamContent(), "US-ASCII"), contentEncoding));
    56
    assertEquals(URLDecoder.decode(new String(expectedUrl, "US-ASCII"), contentEncoding), URLDecoder.decode(new String(connection.getOutputStreamContent(), "US-ASCII"), contentEncoding));
    88
    assertEquals(URLDecoder.decode(new String(expectedUrl, "US-ASCII"), "ISO-8859-1"), URLDecoder.decode(new String(connection.getOutputStreamContent(), "US-ASCII"), "ISO-8859-1"));
    Differences
    Expression1Expression2Difference
    contentEncoding"ISO-8859-1"TYPE_COMPATIBLE_REPLACEMENT
    contentEncoding"ISO-8859-1"TYPE_COMPATIBLE_REPLACEMENT
    88
    assertEquals(URLDecoder.decode(new String(expectedUrl, "US-ASCII"), "ISO-8859-1"), URLDecoder.decode(new String(connection.getOutputStreamContent(), "US-ASCII"), "ISO-8859-1"));
    57
    connection.disconnect();
    89
    connection.disconnect();
    Precondition Violations (0)
    Row Violation