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 = new SampleResult(); 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 testAssertionNoResult()
Number of AST nodes: 7 Number of AST nodes: 7
1
result.setResponseData(readFile("testfiles/XMLSchematest.xml"));
1
result
2
		assertion.setXsdFileName("testfiles/XMLSchema-pass.xsd");
2
 = new SampleResult();
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 statements6
    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
    result = new SampleResult();
    1
    result.setResponseData(readFile("testfiles/XMLSchematest.xml"));
    1
    result.setResponseData(readFile("testfiles/XMLSchematest.xml"));
    7
    assertTrue("Should be a failure", res.isFailure());
    Differences
    Expression1Expression2Difference
    setResponseDataassertTrueMETHOD_INVOCATION_NAME_MISMATCH
    result.setResponseData(readFile("testfiles/XMLSchematest.xml"))assertTrue("Should be a failure",res.isFailure())ARGUMENT_NUMBER_MISMATCH
    resultMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression assertTrue("Should be a failure",res.isFailure()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression result.setResponseData(readFile("testfiles/XMLSchematest.xml")) 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
    Expression assertTrue("Should be a failure",res.isFailure()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression result.setResponseData(readFile("testfiles/XMLSchematest.xml")) 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());
    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());
                                                                                                                        
    Precondition Violations (14)
    Row Violation
    1Expression assertTrue("Should be a failure",res.isFailure()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression result.setResponseData(readFile("testfiles/XMLSchematest.xml")) is a void method call, and thus it cannot be parameterized
    3Expression assertTrue("Should be a failure",res.isFailure()) is a void method call, and thus it cannot be parameterized
    4Expression assertTrue("Should be a failure",res.isFailure()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression result.setResponseData(readFile("testfiles/XMLSchematest.xml")) is a void method call, and thus it cannot be parameterized
    6Expression assertTrue("Should be a failure",res.isFailure()) is a void method call, and thus it cannot be parameterized
    7Expression assertEquals(AssertionResult.RESPONSE_WAS_NULL,res.getFailureMessage()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression assertion.setXsdFileName("testfiles/XMLSchema-pass.xsd") is a void method call, and thus it cannot be parameterized
    9Expression assertEquals(AssertionResult.RESPONSE_WAS_NULL,res.getFailureMessage()) is a void method call, and thus it cannot be parameterized
    10Expression assertEquals(AssertionResult.RESPONSE_WAS_NULL,res.getFailureMessage()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression assertion.setXsdFileName("testfiles/XMLSchema-pass.xsd") is a void method call, and thus it cannot be parameterized
    12Expression assertEquals(AssertionResult.RESPONSE_WAS_NULL,res.getFailureMessage()) is a void method call, and thus it cannot be parameterized
    13Expression 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)
    14Clone fragment #1 returns variables res , while Clone fragment #2 returns variables