Collection parms = new LinkedList(); for (int i=0; i< addends.length; i++){ parms.add(new CompoundVariable(addends[i])); } parms.add(new CompoundVariable("Result")); func.setParameters(parms); assertEquals(value,func.execute(null,null)); assertEquals(value,vars.getObject("Result"));
Collection parms = new LinkedList(); for (int i=0; i< addends.length; i++){ parms.add(new CompoundVariable(addends[i])); } func.setParameters(parms); assertEquals(value,func.execute(null,null));
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/functions/PackageTest.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/functions/PackageTest.java
Method name: void checkSum(AbstractFunction, String, String[]) Method name: void checkSumNoVar(AbstractFunction, String, String[])
Number of AST nodes: 7 Number of AST nodes: 5
1
Collection parms = new LinkedList();
1
Collection parms = new LinkedList();
2
		for (int i=0; i< addends.length; i++){
2
        for (int i=0; i< addends.length; i++){
3
			parms.add(new CompoundVariable(addends[i]));
3
            parms.add(new CompoundVariable(addends[i]));
4
		}
5
		parms.add(new CompoundVariable("Result"));
4
        }
6
    	func.setParameters(parms);
5
        func.setParameters(parms);
7
    	assertEquals(value,func.execute(null,null));
6
        assertEquals(value,func.execute(null,null));
8
    	assertEquals(value,vars.getObject("Result"));
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.2
Clones locationClones are declared in the same class
Number of node comparisons13
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)9.2
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    Collection parms = new LinkedList();
    1
    Collection parms = new LinkedList();
    2
    for (int i = 0; i < addends.length; i++)
    2
    for (int i = 0; i < addends.length; i++)
    3
    parms.add(new CompoundVariable(addends[i]));
    3
    parms.add(new CompoundVariable(addends[i]));
    4
    parms.add(new CompoundVariable("Result"));
    4
    parms.add(new CompoundVariable("Result"));
    Preondition Violations
    Unmatched statement parms.add(new CompoundVariable("Result")); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                              
    5
    func.setParameters(parms);
    4
    func.setParameters(parms);
    6
    assertEquals(value, func.execute(null, null));
    5
    assertEquals(value, func.execute(null, null));
    7
    assertEquals(value, vars.getObject("Result"));
    7
    assertEquals(value, vars.getObject("Result"));
    Preondition Violations
    Unmatched statement assertEquals(value,vars.getObject("Result")); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                    
    Precondition Violations (2)
    Row Violation
    1Unmatched statement parms.add(new CompoundVariable("Result")); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement assertEquals(value,vars.getObject("Result")); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted