File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/selectors/DateSelectorTest.java | File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorTest.java | |||
Method name: void testValidate()
|
Method name: void testRespondsToError()
|
|||
Number of AST nodes: 4 | Number of AST nodes: 4 | |||
1 | s.setDatetime("this is not a date");↵ | 1 | s.setError("test error");↵ | |
2 | try {↵ | 2 | try {↵ | |
3 | s.isSelected(basedir,filenames[0],files[0]);↵ | 3 | s.isSelected(beddir,filenames[0],files[0]);↵ | |
4 | fail("DateSelector did not check for Datetime being in a "↵ | 4 | fail("↵ | |
5 | + "valid format");↵ | 5 | Cannot cause BuildException when setError() is called");↵ | |
6 | } catch (BuildException be3) {↵ | 6 | } catch (BuildException be) {↵ | |
7 | assertEquals("Date of this is not a date"↵ | 7 | assertEquals("↵ | |
8 | + " Cannot be parsed correctly. It should be in"↵ | |||
9 | + " MM/DD/YYYY HH:MM AM_PM format.",↵ | 8 | test error",↵ | |
10 | be3.getMessage());↵ | 9 | be.getMessage());↵ | |
11 | } | 10 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 10 |
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 1.8 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11 | s.setDatetime("this is not a date"); |
| 4 | s.setError("test error"); | ||||||||||||||||||
12 | try |
| 5 | try | ||||||||||||||||||
13 | s.isSelected(basedir, filenames[0], files[0]); |
| 6 | s.isSelected(beddir, filenames[0], files[0]); | ||||||||||||||||||
14 | fail("DateSelector did not check for Datetime being in a " + "valid format"); |
| 7 | fail("Cannot cause BuildException when setError() is called"); |
Row | Violation |
---|---|
1 | Expression s.setDatetime("this is not a date") is a void method call, and thus it cannot be parameterized |
2 | Expression s.setError("test error") is a void method call, and thus it cannot be parameterized |