PropertyFile props = new PropertyFile(); props.setProject( getProject() ); File file = new File("this-file-does-not-exist.properties"); props.setFile(file); assertFalse("Properties file exists before test.", file.exists()); props.execute(); assertTrue("Properties file does not exist after test.", file.exists()); file.delete();
File cachefile = new File(basedir, "cachefile.properties"); PropertiesfileCache cache = new PropertiesfileCache(); cache.setCachefile(cachefile); cache.put("key", "value"); cache.save(); assertTrue("Cachefile not created.", cachefile.exists()); cache.delete(); assertFalse("Cachefile not deleted.", cachefile.exists());
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PropertyFileTest.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
Method name: void testNonExistingFile() Method name: void testCreatePropertiesCacheDirect()
Number of AST nodes: 8 Number of AST nodes: 8
1
PropertyFile props = new PropertyFile();
1
File cachefile = new File(basedir, "cachefile.properties");
2
        props.setProject( getProject() );
2
        Prop
3
        File file = new File("this-file-does-not-exist.properties");
4
        props.setFile(file
3
ertiesfileCache cache = new PropertiesfileCache();
4
        cache.setCachefile(cachefile);
5
        cache.put("key", "value");
5
);
6
        cache.save();
6
        assertFalse("Properties file exists before test.", file.exists());
7
        assertTrue("Cachefile not created.", cachefile.exists());
7
        props.execute();
8
        cache.delete();
8
        assertTrue("Properties file does not exist after test.", file.exists());
9
        assert
9
        file.delete();
10
False("Cachefile not deleted.", cachefile.exists());
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 comparisons54
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    PropertyFile props = new PropertyFile();
                                                                                      
    2
    props.setProject(getProject());
                                                                        
    3
    File file = new File("this-file-does-not-exist.properties");
    3
    File file = new File("this-file-does-not-exist.properties");
    1
    File cachefile = new File(basedir, "cachefile.properties");
    Differences
    Expression1Expression2Difference
    filecachefileVARIABLE_NAME_MISMATCH
    new File("this-file-does-not-exist.properties")new File(basedir,"cachefile.properties")ARGUMENT_NUMBER_MISMATCH
    1
    File cachefile = new File(basedir, "cachefile.properties");
                                                                                                                  
    2
    PropertiesfileCache cache = new PropertiesfileCache();
                                                                      
    3
    cache.setCachefile(cachefile);
    Preondition Violations
    Unmatched statement cache.setCachefile(cachefile); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    cache.setCachefile(cachefile);
                                                            
    4
    cache.put("key", "value");
    4
    props.setFile(file);
    4
    props.setFile(file);
    8
    assertFalse("Cachefile not deleted.", cachefile.exists());
    Differences
    Expression1Expression2Difference
    setFileassertFalseMETHOD_INVOCATION_NAME_MISMATCH
    props.setFile(file)assertFalse("Cachefile not deleted.",cachefile.exists())ARGUMENT_NUMBER_MISMATCH
    propsMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression props.setFile(file) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertFalse("Cachefile not deleted.",cachefile.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression props.setFile(file) is a void method call, and thus it cannot be parameterized
    Expression assertFalse("Cachefile not deleted.",cachefile.exists()) is a void method call, and thus it cannot be parameterized
    Expression props.setFile(file) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertFalse("Cachefile not deleted.",cachefile.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression props.setFile(file) is a void method call, and thus it cannot be parameterized
    Expression assertFalse("Cachefile not deleted.",cachefile.exists()) is a void method call, and thus it cannot be parameterized
    8
    assertFalse("Cachefile not deleted.", cachefile.exists());
    5
    assertFalse("Properties file exists before test.", file.exists());
    5
    assertFalse("Properties file exists before test.", file.exists());
    5
    cache.save();
    Differences
    Expression1Expression2Difference
    assertFalsesaveMETHOD_INVOCATION_NAME_MISMATCH
    assertFalse("Properties file exists before test.",file.exists())cache.save()ARGUMENT_NUMBER_MISMATCH
    cacheMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression assertFalse("Properties file exists before test.",file.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertFalse("Properties file exists before test.",file.exists()) is a void method call, and thus it cannot be parameterized
    Expression cache.save() is a void method call, and thus it cannot be parameterized
    Expression assertFalse("Properties file exists before test.",file.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertFalse("Properties file exists before test.",file.exists()) is a void method call, and thus it cannot be parameterized
    Expression cache.save() is a void method call, and thus it cannot be parameterized
    5
    cache.save();
    6
    props.execute();
    6
    props.execute();
    6
    assertTrue("Cachefile not created.", cachefile.exists());
    Differences
    Expression1Expression2Difference
    executeassertTrueMETHOD_INVOCATION_NAME_MISMATCH
    props.execute()assertTrue("Cachefile not created.",cachefile.exists())ARGUMENT_NUMBER_MISMATCH
    propsMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression props.execute() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertTrue("Cachefile not created.",cachefile.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression props.execute() is a void method call, and thus it cannot be parameterized
    Expression assertTrue("Cachefile not created.",cachefile.exists()) is a void method call, and thus it cannot be parameterized
    Expression props.execute() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertTrue("Cachefile not created.",cachefile.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression props.execute() is a void method call, and thus it cannot be parameterized
    Expression assertTrue("Cachefile not created.",cachefile.exists()) is a void method call, and thus it cannot be parameterized
    6
    assertTrue("Cachefile not created.", cachefile.exists());
    7
    assertTrue("Properties file does not exist after test.", file.exists());
    7
    assertTrue("Properties file does not exist after test.", file.exists());
    7
    cache.delete();
    Differences
    Expression1Expression2Difference
    assertTruedeleteMETHOD_INVOCATION_NAME_MISMATCH
    assertTrue("Properties file does not exist after test.",file.exists())cache.delete()ARGUMENT_NUMBER_MISMATCH
    cacheMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression assertTrue("Properties file does not exist after test.",file.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression cache.delete() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertTrue("Properties file does not exist after test.",file.exists()) is a void method call, and thus it cannot be parameterized
    Expression cache.delete() is a void method call, and thus it cannot be parameterized
    Expression assertTrue("Properties file does not exist after test.",file.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression cache.delete() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertTrue("Properties file does not exist after test.",file.exists()) is a void method call, and thus it cannot be parameterized
    Expression cache.delete() is a void method call, and thus it cannot be parameterized
    7
    cache.delete();
    8
    file.delete();
                                      
    Precondition Violations (31)
    Row Violation
    1Unmatched statement cache.setCachefile(cachefile); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Expression props.setFile(file) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression assertFalse("Cachefile not deleted.",cachefile.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression props.setFile(file) is a void method call, and thus it cannot be parameterized
    5Expression assertFalse("Cachefile not deleted.",cachefile.exists()) is a void method call, and thus it cannot be parameterized
    6Expression props.setFile(file) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression assertFalse("Cachefile not deleted.",cachefile.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression props.setFile(file) is a void method call, and thus it cannot be parameterized
    9Expression assertFalse("Cachefile not deleted.",cachefile.exists()) is a void method call, and thus it cannot be parameterized
    10Expression assertFalse("Properties file exists before test.",file.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression assertFalse("Properties file exists before test.",file.exists()) is a void method call, and thus it cannot be parameterized
    12Expression cache.save() is a void method call, and thus it cannot be parameterized
    13Expression assertFalse("Properties file exists before test.",file.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression assertFalse("Properties file exists before test.",file.exists()) is a void method call, and thus it cannot be parameterized
    15Expression cache.save() is a void method call, and thus it cannot be parameterized
    16Expression props.execute() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Expression assertTrue("Cachefile not created.",cachefile.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18Expression props.execute() is a void method call, and thus it cannot be parameterized
    19Expression assertTrue("Cachefile not created.",cachefile.exists()) is a void method call, and thus it cannot be parameterized
    20Expression props.execute() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    21Expression assertTrue("Cachefile not created.",cachefile.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    22Expression props.execute() is a void method call, and thus it cannot be parameterized
    23Expression assertTrue("Cachefile not created.",cachefile.exists()) is a void method call, and thus it cannot be parameterized
    24Expression assertTrue("Properties file does not exist after test.",file.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    25Expression cache.delete() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    26Expression assertTrue("Properties file does not exist after test.",file.exists()) is a void method call, and thus it cannot be parameterized
    27Expression cache.delete() is a void method call, and thus it cannot be parameterized
    28Expression assertTrue("Properties file does not exist after test.",file.exists()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    29Expression cache.delete() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    30Expression assertTrue("Properties file does not exist after test.",file.exists()) is a void method call, and thus it cannot be parameterized
    31Expression cache.delete() is a void method call, and thus it cannot be parameterized