vars.put("URL", "/query.cgi?s1=1&s2=2&s3=3"); params.add(new CompoundVariable("vars.get('URL').replaceAll('&','&')")); params.add(new CompoundVariable("URL")); function.setParameters(params); String ret = function.execute(result, null); assertEquals("/query.cgi?s1=1&s2=2&s3=3", ret); assertEquals(ret,vars.getObject("URL"));
SampleResult result = new SampleResult(); control.setContentTypeExclude("text/css"); result.setContentType(null); assertTrue("Should allow if no content-type present", control.filterContentType(result)); result.setContentType("text/html; charset=utf-8"); assertTrue("Should allow text/html", control.filterContentType(result)); result.setContentType("text/css"); assertFalse("Should not allow text/css", control.filterContentType(result));
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/functions/TestJexlFunction.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/proxy/TestProxyControl.java
Method name: void testReplace2() Method name: void testContentTypeExclude()
Number of AST nodes: 7 Number of AST nodes: 8
1
vars.put("URL", "/query.cgi?s1=1&s2=2&s3=3");
2
        params.add(new CompoundVariable("vars.get('URL').replaceAll('&','&')"));
3
        params.add(new CompoundVariable("URL"));
4
        function.setParameters(params);
5
        String ret = function.execute(result, null);
6
        assertEquals("/query.cgi?s1=1&s2=2&s3=3", ret);
7
        
1
SampleResult result = new SampleResult();
2
			control.setContentTypeExclude("text/css");
3
			result.setContentType(null);
4
			assertTrue("Should allow if no content-type present", control.filterContentType(result));			
5
			result.setContentType("text/html; charset=utf-8");
6
			assertTrue("Should allow text/html", control.filterContentType(result));			
7
			result.setContentType("text/css");
8
assertEquals(ret,vars.getObject("URL"));
8
			assertFalse("Should not allow text/css", control.filterContentType(result));
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 comparisons56
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment5
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                        
    1
    SampleResult result = new SampleResult();
    1
    vars.put("URL", "/query.cgi?s1=1&s2=2&s3=3");
                                                                                                                  
                                                                                              
    2
    control.setContentTypeExclude("text/css");
    2
    params.add(new CompoundVariable("vars.get('URL').replaceAll('&','&')"));
                                                                                                                                                                  
                                                                  
    3
    result.setContentType(null);
    3
    params.add(new CompoundVariable("URL"));
                                                                                          
    4
    function.setParameters(params);
    4
    function.setParameters(params);
    4
    assertTrue("Should allow if no content-type present", control.filterContentType(result));
    Differences
    Expression1Expression2Difference
    setParametersassertTrueMETHOD_INVOCATION_NAME_MISMATCH
    function.setParameters(params)assertTrue("Should allow if no content-type present",control.filterContentType(result))ARGUMENT_NUMBER_MISMATCH
    functionMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression function.setParameters(params) is a void method call, and thus it cannot be parameterized
    Expression assertTrue("Should allow if no content-type present",control.filterContentType(result)) is a void method call, and thus it cannot be parameterized
    Expression function.setParameters(params) is a void method call, and thus it cannot be parameterized
    Expression assertTrue("Should allow if no content-type present",control.filterContentType(result)) is a void method call, and thus it cannot be parameterized
    4
    assertTrue("Should allow if no content-type present", control.filterContentType(result));
    5
    String ret = function.execute(result, null);
    5
    String ret = function.execute(result, null);
    Preondition Violations
    Unmatched statement String ret=function.execute(result,null); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                            
    6
    assertEquals("/query.cgi?s1=1&s2=2&s3=3", ret);
    6
    assertEquals("/query.cgi?s1=1&s2=2&s3=3", ret);
    5
    result.setContentType("text/html; charset=utf-8");
    Differences
    Expression1Expression2Difference
    assertEqualssetContentTypeMETHOD_INVOCATION_NAME_MISMATCH
    assertEquals("/query.cgi?s1=1&s2=2&s3=3",ret)result.setContentType("text/html; charset=utf-8")ARGUMENT_NUMBER_MISMATCH
    resultMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression result.setContentType("text/html; charset=utf-8") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertEquals("/query.cgi?s1=1&s2=2&s3=3",ret) is a void method call, and thus it cannot be parameterized
    Expression result.setContentType("text/html; charset=utf-8") is a void method call, and thus it cannot be parameterized
    Expression result.setContentType("text/html; charset=utf-8") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertEquals("/query.cgi?s1=1&s2=2&s3=3",ret) is a void method call, and thus it cannot be parameterized
    Expression result.setContentType("text/html; charset=utf-8") is a void method call, and thus it cannot be parameterized
    5
    result.setContentType("text/html; charset=utf-8");
                                                                                                                                                        
    6
    assertTrue("Should allow text/html", control.filterContentType(result));
    Preondition Violations
    Unmatched statement assertTrue("Should allow text/html",control.filterContentType(result)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    assertTrue("Should allow text/html", control.filterContentType(result));
    7
    assertEquals(ret, vars.getObject("URL"));
    7
    assertEquals(ret, vars.getObject("URL"));
    7
    result.setContentType("text/css");
    Differences
    Expression1Expression2Difference
    assertEqualssetContentTypeMETHOD_INVOCATION_NAME_MISMATCH
    assertEquals(ret,vars.getObject("URL"))result.setContentType("text/css")ARGUMENT_NUMBER_MISMATCH
    resultMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression result.setContentType("text/css") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertEquals(ret,vars.getObject("URL")) is a void method call, and thus it cannot be parameterized
    Expression result.setContentType("text/css") is a void method call, and thus it cannot be parameterized
    Expression result.setContentType("text/css") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertEquals(ret,vars.getObject("URL")) is a void method call, and thus it cannot be parameterized
    Expression result.setContentType("text/css") is a void method call, and thus it cannot be parameterized
    7
    result.setContentType("text/css");
                                                                                                                                                                
    8
    assertFalse("Should not allow text/css", control.filterContentType(result));
    Preondition Violations
    Unmatched statement assertFalse("Should not allow text/css",control.filterContentType(result)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    assertFalse("Should not allow text/css", control.filterContentType(result));
    Precondition Violations (19)
    Row Violation
    1Expression function.setParameters(params) is a void method call, and thus it cannot be parameterized
    2Expression assertTrue("Should allow if no content-type present",control.filterContentType(result)) is a void method call, and thus it cannot be parameterized
    3Expression function.setParameters(params) is a void method call, and thus it cannot be parameterized
    4Expression assertTrue("Should allow if no content-type present",control.filterContentType(result)) is a void method call, and thus it cannot be parameterized
    5Unmatched statement String ret=function.execute(result,null); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Expression result.setContentType("text/html; charset=utf-8") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression assertEquals("/query.cgi?s1=1&s2=2&s3=3",ret) is a void method call, and thus it cannot be parameterized
    8Expression result.setContentType("text/html; charset=utf-8") is a void method call, and thus it cannot be parameterized
    9Expression result.setContentType("text/html; charset=utf-8") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression assertEquals("/query.cgi?s1=1&s2=2&s3=3",ret) is a void method call, and thus it cannot be parameterized
    11Expression result.setContentType("text/html; charset=utf-8") is a void method call, and thus it cannot be parameterized
    12Unmatched statement assertTrue("Should allow text/html",control.filterContentType(result)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    13Expression result.setContentType("text/css") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression assertEquals(ret,vars.getObject("URL")) is a void method call, and thus it cannot be parameterized
    15Expression result.setContentType("text/css") is a void method call, and thus it cannot be parameterized
    16Expression result.setContentType("text/css") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Expression assertEquals(ret,vars.getObject("URL")) is a void method call, and thus it cannot be parameterized
    18Expression result.setContentType("text/css") is a void method call, and thus it cannot be parameterized
    19Unmatched statement assertFalse("Should not allow text/css",control.filterContentType(result)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted