result.setResponseData(readFile("testfiles/XMLSchematest.xml")); assertion.setXsdFileName("testfiles/XMLSchema-pass.xsd"); AssertionResult res = assertion.getResult(jmctx.getPreviousResult()); testLog.debug("isError() " + res.isError() + " isFailure() " + res.isFailure()); testLog.debug("failure " + res.getFailureMessage()); assertFalse("Should not be an error", res.isError()); assertFalse("Should not be a failure", res.isFailure());
result.setResponseData("".getBytes()); AssertionResult res = assertion.getResult(result); testLog.debug("isError() " + res.isError() + " isFailure() " + res.isFailure()); testLog.debug("failure message: " + res.getFailureMessage()); assertEquals(AssertionResult.RESPONSE_WAS_NULL, res.getFailureMessage()); assertFalse("Should not be an error", res.isError()); assertTrue("Should be a failure",res.isFailure());
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/assertions/XMLSchemaAssertionTest.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/assertions/XPathAssertionTest.java
Method name: void testAssertionOK() Method name: void testAssertionEmptyResult()
Number of AST nodes: 7 Number of AST nodes: 7
1
result.setResponseData(readFile("testfiles/XMLSchematest.xml"));
1
result.setResponseData(
2
		assertion.setXsdFileName("testfiles/XMLSchema-pass.xsd");
2
"".getBytes());
3
		AssertionResult res = assertion.getResult(jmctx.getPreviousResult());
3
		AssertionResult res = assertion.getResult(result);
4
		testLog.debug("isError() " + res.isError() + " isFailure() " + res.isFailure());
4
		testLog.debug("isError() " + res.isError() + " isFailure() " + res.isFailure());
5
		testLog.debug("failure " + res.getFailureMessage());
5
		testLog.debug("failure message: " + res.getFailureMessage());
6
		
6
		assertEquals(AssertionResult.RESPONSE_WAS_NULL, res.getFailureMessage());
7
assertFalse("Should not be an error", res.isError());
7
		assertFalse("Should not be an error", res.isError());
8
		assertFalse("Should not be a failure", res.isFailure());
8
		assertTrue("Should be a failure",res.isFailure());
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 comparisons49
  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)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    result.setResponseData(readFile("testfiles/XMLSchematest.xml"));
    1
    result.setResponseData(readFile("testfiles/XMLSchematest.xml"));
    1
    result.setResponseData("".getBytes());
    Differences
    Expression1Expression2Difference
    readFilegetBytesMETHOD_INVOCATION_NAME_MISMATCH
    readFile("testfiles/XMLSchematest.xml")"".getBytes()ARGUMENT_NUMBER_MISMATCH
    ""MISSING_METHOD_INVOCATION_EXPRESSION
    1
    result.setResponseData("".getBytes());
    2
    assertion.setXsdFileName("testfiles/XMLSchema-pass.xsd");
    2
    assertion.setXsdFileName("testfiles/XMLSchema-pass.xsd");
    5
    assertEquals(AssertionResult.RESPONSE_WAS_NULL, res.getFailureMessage());
    Differences
    Expression1Expression2Difference
    setXsdFileNameassertEqualsMETHOD_INVOCATION_NAME_MISMATCH
    assertion.setXsdFileName("testfiles/XMLSchema-pass.xsd")assertEquals(AssertionResult.RESPONSE_WAS_NULL,res.getFailureMessage())ARGUMENT_NUMBER_MISMATCH
    assertionMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression assertEquals(AssertionResult.RESPONSE_WAS_NULL,res.getFailureMessage()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertion.setXsdFileName("testfiles/XMLSchema-pass.xsd") is a void method call, and thus it cannot be parameterized
    Expression assertEquals(AssertionResult.RESPONSE_WAS_NULL,res.getFailureMessage()) is a void method call, and thus it cannot be parameterized
    Expression assertEquals(AssertionResult.RESPONSE_WAS_NULL,res.getFailureMessage()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertion.setXsdFileName("testfiles/XMLSchema-pass.xsd") is a void method call, and thus it cannot be parameterized
    Expression assertEquals(AssertionResult.RESPONSE_WAS_NULL,res.getFailureMessage()) is a void method call, and thus it cannot be parameterized
    5
    assertEquals(AssertionResult.RESPONSE_WAS_NULL, res.getFailureMessage());
    3
    AssertionResult res = assertion.getResult(jmctx.getPreviousResult());
    3
    AssertionResult res = assertion.getResult(jmctx.getPreviousResult());
    2
    AssertionResult res = assertion.getResult(result);
    Differences
    Expression1Expression2Difference
    jmctx.getPreviousResult()resultTYPE_COMPATIBLE_REPLACEMENT
    org.apache.jmeter.assertions.XMLSchemaAssertionorg.apache.jmeter.assertions.XPathAssertionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression assertion cannot be unified with expression assertion , because common superclass org.apache.jmeter.testelement.AbstractTestElement does not declare member(s) public org.apache.jmeter.assertions.AssertionResult getResult(org.apache.jmeter.samplers.SampleResult)
    2
    AssertionResult res = assertion.getResult(result);
    4
    testLog.debug("isError() " + res.isError() + " isFailure() " + res.isFailure());
    3
    testLog.debug("isError() " + res.isError() + " isFailure() " + res.isFailure());
    5
    testLog.debug("failure " + res.getFailureMessage());
    5
    testLog.debug("failure " + res.getFailureMessage());
    4
    testLog.debug("failure message: " + res.getFailureMessage());
    Differences
    Expression1Expression2Difference
    "failure ""failure message: "LITERAL_VALUE_MISMATCH
    4
    testLog.debug("failure message: " + res.getFailureMessage());
    6
    assertFalse("Should not be an error", res.isError());
    6
    assertFalse("Should not be an error", res.isError());
    7
    assertFalse("Should not be a failure", res.isFailure());
    7
    assertFalse("Should not be a failure", res.isFailure());
    7
    assertTrue("Should be a failure", res.isFailure());
    Differences
    Expression1Expression2Difference
    assertFalseassertTrueMETHOD_INVOCATION_NAME_MISMATCH
    "Should not be a failure""Should be a failure"LITERAL_VALUE_MISMATCH
    Preondition Violations
    Expression assertFalse("Should not be a failure",res.isFailure()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertTrue("Should be a failure",res.isFailure()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertFalse("Should not be a failure",res.isFailure()) is a void method call, and thus it cannot be parameterized
    Expression assertTrue("Should be a failure",res.isFailure()) is a void method call, and thus it cannot be parameterized
    7
    assertTrue("Should be a failure", res.isFailure());
    Precondition Violations (11)
    Row Violation
    1Expression assertEquals(AssertionResult.RESPONSE_WAS_NULL,res.getFailureMessage()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression assertion.setXsdFileName("testfiles/XMLSchema-pass.xsd") is a void method call, and thus it cannot be parameterized
    3Expression assertEquals(AssertionResult.RESPONSE_WAS_NULL,res.getFailureMessage()) is a void method call, and thus it cannot be parameterized
    4Expression assertEquals(AssertionResult.RESPONSE_WAS_NULL,res.getFailureMessage()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression assertion.setXsdFileName("testfiles/XMLSchema-pass.xsd") is a void method call, and thus it cannot be parameterized
    6Expression assertEquals(AssertionResult.RESPONSE_WAS_NULL,res.getFailureMessage()) is a void method call, and thus it cannot be parameterized
    7Expression assertion cannot be unified with expression assertion , because common superclass org.apache.jmeter.testelement.AbstractTestElement does not declare member(s) public org.apache.jmeter.assertions.AssertionResult getResult(org.apache.jmeter.samplers.SampleResult)
    8Expression assertFalse("Should not be a failure",res.isFailure()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression assertTrue("Should be a failure",res.isFailure()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression assertFalse("Should not be a failure",res.isFailure()) is a void method call, and thus it cannot be parameterized
    11Expression assertTrue("Should be a failure",res.isFailure()) is a void method call, and thus it cannot be parameterized