void testValidateWrongCache() { String name = "this-is-not-a-valid-cache-name"; try { ModifiedSelector.CacheName cacheName = new ModifiedSelector.CacheName(); cacheName.setValue(name); fail("CacheSelector.CacheName accepted invalid value."); } catch (BuildException be) { assertEquals(name + " is not a legal value for this attribute", be.getMessage()); } } /** Test right use of cache names. */ public void testValidateWrongAlgorithm() { String name = "this-is-not-a-valid-algorithm-name"; try { ModifiedSelector.AlgorithmName algoName = new ModifiedSelector.AlgorithmName(); algoName.setValue(name); fail("CacheSelector.AlgorithmName accepted invalid value."); } catch (BuildException be) { assertEquals(name + " is not a legal value for this attribute", be.getMessage()); }
void testValidateWrongAlgorithm() { String name = "this-is-not-a-valid-algorithm-name"; try { ModifiedSelector.AlgorithmName algoName = new ModifiedSelector.AlgorithmName(); algoName.setValue(name); fail("CacheSelector.AlgorithmName accepted invalid value."); } catch (BuildException be) { assertEquals(name + " is not a legal value for this attribute", be.getMessage()); } } /** Test right use of comparator names. */ public void testValidateWrongComparator() { String name = "this-is-not-a-valid-comparator-name"; try { ModifiedSelector.ComparatorName compName = new ModifiedSelector.ComparatorName(); compName.setValue(name); fail("ModifiedSelector.ComparatorName accepted invalid value."); } catch (BuildException be) { assertEquals(name + " is not a legal value for this attribute", be.getMessage()); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
void testValidateWrongCache() {
1
void testValidateWrongAlgorithm() {
2
        String name = "this-is-not-a-valid-cache-name";
2
        String name = "this-is-not-a-valid-algorithm-name";
3
        try {
3
        try {
4
            ModifiedSelector.CacheName cacheName
4
            ModifiedSelector.AlgorithmName algoName
5
 = new ModifiedSelector.CacheName();
5
                = new ModifiedSelector.AlgorithmName();
6
            cacheName.setValue(name);
6
            algoName.setValue(name);
7
            fail("CacheSelector.CacheName accepted invalid value.");
7
            fail("CacheSelector.AlgorithmName accepted invalid value.");
8
        } catch (BuildException be) {
8
        } catch (BuildException be) {
9
            assertEquals(name + " is not a legal value for this attribute",
9
            assertEquals(name + " is not a legal value for this attribute",
10
                         be.getMessage());
10
                         be.getMessage());
11
        }
11
        }
12
    }
12
    }
13
    /** Test right use of cache names. */
13
    /** Test right use of comparator names. */
14
    public void testValidateWrongAlgorithm() {
14
    public void testValidateWrongComparator() {
15
        String name = "this-is-not-a-valid-algorithm-name";
15
        String name = "this-is-not-a-valid-comparator-name";
16
        try {
16
        try {
17
            ModifiedSelector.AlgorithmName algoName
17
            ModifiedSelector.ComparatorName compName
18
                = new ModifiedSelector.AlgorithmName();
18
                = new ModifiedSelector.ComparatorName();
19
            algoName.setValue(name);
19
            compName.setValue(name);
20
            fail("CacheSelector.AlgorithmName accepted invalid value.");
20
            fail("ModifiedSelector.ComparatorName accepted invalid value.");
21
        } catch (BuildException be) {
21
        } catch (BuildException be) {
22
            assertEquals(name + " is not a legal value for this attribute",
22
            assertEquals(name + " is not a legal value for this attribute",
23
                         be.getMessage());
23
                         be.getMessage());
24
        }
24
        }
25
    
25
    
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0