File path: /jfreechart-1.0.10/tests/org/jfree/data/time/junit/MonthTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/data/time/junit/QuarterTests.java | |||
Method name: void testParseMonth()
|
Method name: void testParseQuarter()
|
|||
Number of AST nodes: 13 | Number of AST nodes: 13 | |||
1 | Month month = null;↵ | 1 | Quarter quarter = null;↵ | |
2 | // test 1...↵ | 2 | // test 1...↵ | |
3 | try {↵ | 3 | try {↵ | |
4 | month = Month.parseMonth("1990-01");↵ | 4 | quarter = Quarter.parseQuarter("Q1-2000");↵ | |
5 | }↵ | 5 | }↵ | |
6 | catch (TimePeriodFormatException e) {↵ | 6 | catch (TimePeriodFormatException e) {↵ | |
7 | month = new Month(1, 1900);↵ | 7 | quarter = new Quarter(1, 1900);↵ | |
8 | }↵ | 8 | }↵ | |
9 | assertEquals(1, month.getMonth());↵ | 9 | assertEquals(1, quarter.getQuarter());↵ | |
10 | assertEquals(1990, month.getYear().getYear());↵ | 10 | assertEquals(2000, quarter.getYear().getYear());↵ | |
11 | // test 2...↵ | 11 | // test 2...↵ | |
12 | try {↵ | 12 | try {↵ | |
13 | month = Month.parseMonth("02-1991");↵ | 13 | quarter = Quarter.parseQuarter("2001-Q2");↵ | |
14 | }↵ | 14 | }↵ | |
15 | catch (TimePeriodFormatException e) {↵ | 15 | catch (TimePeriodFormatException e) {↵ | |
16 | month = new Month(1, 1900);↵ | 16 | quarter = new Quarter(1, 1900);↵ | |
17 | }↵ | 17 | }↵ | |
18 | assertEquals(2, month.getMonth());↵ | 18 | assertEquals(2, quarter.getQuarter());↵ | |
19 | assertEquals(1991, month.getYear().getYear());↵ | 19 | assertEquals(2001, quarter.getYear().getYear());↵ | |
20 | // test 3...↵ | 20 | // test 3...↵ | |
21 | try {↵ | 21 | try {↵ | |
22 | month = Month.parseMonth("March 1993");↵ | 22 | quarter = Quarter.parseQuarter("Q3, 2002");↵ | |
23 | }↵ | 23 | }↵ | |
24 | catch (TimePeriodFormatException e) {↵ | 24 | catch (TimePeriodFormatException e) {↵ | |
25 | month = new Month(1, 1900);↵ | 25 | quarter = new Quarter(1, 1900);↵ | |
26 | }↵ | 26 | }↵ | |
27 | assertEquals(3, month.getMonth());↵ | 27 | assertEquals(3, quarter.getQuarter());↵ | |
28 | assertEquals(1993, month.getYear().getYear()); | 28 | assertEquals(2002, quarter.getYear().getYear()); | |
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) | 2.6 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 76 |
Number of mapped statements | 13 |
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) | 32.4 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Month month = null; |
| 1 | Quarter quarter = null; | ||||||||||||||||||||||||||
2 | try |
| 2 | try | ||||||||||||||||||||||||||
3 | month = Month.parseMonth("1990-01"); |
| 3 | quarter = Quarter.parseQuarter("Q1-2000"); | ||||||||||||||||||||||||||
4 | assertEquals(1, month.getMonth()); |
| 4 | assertEquals(1, quarter.getQuarter()); | ||||||||||||||||||||||||||
5 | assertEquals(1990, month.getYear().getYear()); |
| 5 | assertEquals(2000, quarter.getYear().getYear()); | ||||||||||||||||||||||||||
6 | try |
| 6 | try | ||||||||||||||||||||||||||
7 | month = Month.parseMonth("02-1991"); |
| 7 | quarter = Quarter.parseQuarter("2001-Q2"); | ||||||||||||||||||||||||||
8 | assertEquals(2, month.getMonth()); |
| 8 | assertEquals(2, quarter.getQuarter()); | ||||||||||||||||||||||||||
9 | assertEquals(1991, month.getYear().getYear()); |
| 9 | assertEquals(2001, quarter.getYear().getYear()); | ||||||||||||||||||||||||||
10 | try |
| 10 | try | ||||||||||||||||||||||||||
11 | month = Month.parseMonth("March 1993"); |
| 11 | quarter = Quarter.parseQuarter("Q3, 2002"); | ||||||||||||||||||||||||||
12 | assertEquals(3, month.getMonth()); |
| 12 | assertEquals(3, quarter.getQuarter()); | ||||||||||||||||||||||||||
13 | assertEquals(1993, month.getYear().getYear()); |
| 13 | assertEquals(2002, quarter.getYear().getYear()); |
Row | Violation |
---|---|
1 | Expression new Month(1,1900) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression new Quarter(1,1900) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression month cannot be unified with expression quarter , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public static org.jfree.data.time.Month parseMonth(java.lang.String) , public static org.jfree.data.time.Quarter parseQuarter(java.lang.String) |
4 | Expression Month.parseMonth("1990-01") is a method call throwing exception(s) that should be caught by a try block that will be extracted |
5 | Expression Quarter.parseQuarter("Q1-2000") is a method call throwing exception(s) that should be caught by a try block that will be extracted |
6 | Expression Month cannot be unified with expression Quarter , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public static org.jfree.data.time.Month parseMonth(java.lang.String) , public static org.jfree.data.time.Quarter parseQuarter(java.lang.String) |
7 | Expression month.getMonth() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression quarter.getQuarter() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
9 | Expression month cannot be unified with expression quarter , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public int getMonth() , public int getQuarter() |
10 | Expression month cannot be unified with expression quarter , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public org.jfree.data.time.Year getYear() |
11 | Expression new Month(1,1900) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
12 | Expression new Quarter(1,1900) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
13 | Expression month cannot be unified with expression quarter , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public static org.jfree.data.time.Month parseMonth(java.lang.String) , public static org.jfree.data.time.Quarter parseQuarter(java.lang.String) |
14 | Expression Month.parseMonth("02-1991") is a method call throwing exception(s) that should be caught by a try block that will be extracted |
15 | Expression Quarter.parseQuarter("2001-Q2") is a method call throwing exception(s) that should be caught by a try block that will be extracted |
16 | Expression Month cannot be unified with expression Quarter , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public static org.jfree.data.time.Month parseMonth(java.lang.String) , public static org.jfree.data.time.Quarter parseQuarter(java.lang.String) |
17 | Expression month.getMonth() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
18 | Expression quarter.getQuarter() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
19 | Expression month cannot be unified with expression quarter , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public int getMonth() , public int getQuarter() |
20 | Expression month cannot be unified with expression quarter , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public org.jfree.data.time.Year getYear() |
21 | Expression new Month(1,1900) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
22 | Expression new Quarter(1,1900) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
23 | Expression month cannot be unified with expression quarter , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public static org.jfree.data.time.Month parseMonth(java.lang.String) , public static org.jfree.data.time.Quarter parseQuarter(java.lang.String) |
24 | Expression Month.parseMonth("March 1993") is a method call throwing exception(s) that should be caught by a try block that will be extracted |
25 | Expression Quarter.parseQuarter("Q3, 2002") is a method call throwing exception(s) that should be caught by a try block that will be extracted |
26 | Expression Month cannot be unified with expression Quarter , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public static org.jfree.data.time.Month parseMonth(java.lang.String) , public static org.jfree.data.time.Quarter parseQuarter(java.lang.String) |
27 | Expression month.getMonth() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
28 | Expression quarter.getQuarter() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
29 | Expression month cannot be unified with expression quarter , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public int getMonth() , public int getQuarter() |
30 | Expression month cannot be unified with expression quarter , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public org.jfree.data.time.Year getYear() |