207-1-2

public void test5() { TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Calendar cal = Calendar.getInstance(Locale.UK); cal.set(Calendar.YEAR, 2004); cal.set(Calendar.MONTH, Calendar.MARCH); cal.set(Calendar.DAY_OF_MONTH, 25); cal.set(Calendar.HOUR_OF_DAY, 17); cal.set(Calendar.MINUTE, 30); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); Date date = cal.getTime(); SegmentedTimeline timeline = getTimeline(); long value = timeline.toTimelineValue(date); long ms = timeline.toMillisecond(value); Calendar cal2 = Calendar.getInstance(Locale.UK); cal2.setTime(new Date(ms)); Date reverted = cal2.getTime(); Calendar expectedReverted = Calendar.getInstance(Locale.UK); expectedReverted.set(Calendar.YEAR, 2004); expectedReverted.set(Calendar.MONTH, Calendar.MARCH); expectedReverted.set(Calendar.DAY_OF_MONTH, 26); expectedReverted.set(Calendar.HOUR_OF_DAY, 9); expectedReverted.set(Calendar.MINUTE, 0); expectedReverted.set(Calendar.SECOND, 0); expectedReverted.set(Calendar.MILLISECOND, 0); assertTrue( "test5", value == (900000 * 34) && expectedReverted.getTime().getTime() == reverted.getTime() ); TimeZone.setDefault(savedZone);
public void test6() { TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Calendar cal = Calendar.getInstance(Locale.UK); cal.set(Calendar.YEAR, 2004); cal.set(Calendar.MONTH, Calendar.MARCH); cal.set(Calendar.DAY_OF_MONTH, 28); cal.set(Calendar.HOUR_OF_DAY, 9); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); Date date = cal.getTime(); SegmentedTimeline timeline = getTimeline(); long value = timeline.toTimelineValue(date); long ms = timeline.toMillisecond(value); Calendar cal2 = Calendar.getInstance(Locale.UK); cal2.setTime(new Date(ms)); Date reverted = cal2.getTime(); Calendar expectedReverted = Calendar.getInstance(Locale.UK); expectedReverted.set(Calendar.YEAR, 2004); expectedReverted.set(Calendar.MONTH, Calendar.MARCH); expectedReverted.set(Calendar.DAY_OF_MONTH, 29); expectedReverted.set(Calendar.HOUR_OF_DAY, 9); expectedReverted.set(Calendar.MINUTE, 0); expectedReverted.set(Calendar.SECOND, 0); expectedReverted.set(Calendar.MILLISECOND, 0); assertTrue( "test6", value == (900000 * 34 * 2) && expectedReverted.getTime().getTime() == reverted.getTime() ); TimeZone.setDefault(savedZone);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/SegmentedTimelineTests2.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/SegmentedTimelineTests2.java
Method name: `` |  | Method name: ``
Number of AST nodes: 0 |  | Number of AST nodes: 0

1

    public void test5() {↵

1

    public void test6() {↵

2

            TimeZone savedZone = TimeZone.getDefault();↵

2

            TimeZone savedZone = TimeZone.getDefault();↵

3

            TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));↵

3

            TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));↵

4

            Calendar cal = Calendar.getInstance(Locale.UK);↵

4

            Calendar cal = Calendar.getInstance(Locale.UK);↵

5

            cal.set(Calendar.YEAR, 2004);↵

5

            cal.set(Calendar.YEAR, 2004);↵

6

            cal.set(Calendar.MONTH, Calendar.MARCH);↵

6

            cal.set(Calendar.MONTH, Calendar.MARCH);↵

7

            cal.set(Calendar.DAY_OF_MONTH, 25);↵

7

            cal.set(Calendar.DAY_OF_MONTH, 28);↵

8

            cal.set(Calendar.HOUR_OF_DAY, 17);↵

8

            cal.set(Calendar.HOUR_OF_DAY, 9);↵

9

            cal.set(Calendar.MINUTE, 30);↵

9

            cal.set(Calendar.MINUTE, 0);↵

10

            cal.set(Calendar.SECOND, 0);↵

10

            cal.set(Calendar.SECOND, 0);↵

11

            cal.set(Calendar.MILLISECOND, 0);↵

11

            cal.set(Calendar.MILLISECOND, 0);↵

12

            Date date = cal.getTime();↵

12

            Date date = cal.getTime();↵

13

            SegmentedTimeline timeline = getTimeline();      ↵

13

            SegmentedTimeline timeline = getTimeline();      ↵

14

            long value = timeline.toTimelineValue(date);   ↵

14

            long value = timeline.toTimelineValue(date);   ↵

15

            long ms = timeline.toMillisecond(value);↵

15

            long ms = timeline.toMillisecond(value);↵

16

            Calendar cal2 = Calendar.getInstance(Locale.UK);↵

16

            Calendar cal2 = Calendar.getInstance(Locale.UK);↵

17

            cal2.setTime(new Date(ms));↵

17

            cal2.setTime(new Date(ms));↵

18

            Date reverted = cal2.getTime();↵

18

            Date reverted = cal2.getTime();↵

19

          ↵

19

          ↵

20

      Calendar expectedReverted = Calendar.getInstance(Locale.UK);↵

20

            Calendar expectedReverted = Calendar.getInstance(Locale.UK);↵

21

            expectedReverted.set(Calendar.YEAR, 2004);↵

21

            expectedReverted.set(Calendar.YEAR, 2004);↵

22

            expectedReverted.set(Calendar.MONTH, Calendar.MARCH);↵

22

            expectedReverted.set(Calendar.MONTH, Calendar.MARCH);↵

23

            expectedReverted.set(Calendar.DAY_OF_MONTH, 26);↵

23

            expectedReverted.set(Calendar.DAY_OF_MONTH, 29);↵

24

            expectedReverted.set(Calendar.HOUR_OF_DAY, 9);↵

24

            expectedReverted.set(Calendar.HOUR_OF_DAY, 9);↵

25

            expectedReverted.set(Calendar.MINUTE, 0);↵

25

            expectedReverted.set(Calendar.MINUTE, 0);↵

26

            expectedReverted.set(Calendar.SECOND, 0);↵

26

            expectedReverted.set(Calendar.SECOND, 0);↵

27

            expectedReverted.set(Calendar.MILLISECOND, 0);↵

27

            expectedReverted.set(Calendar.MILLISECOND, 0);↵

28

          ↵

28

          ↵

29

            assertTrue(↵

29

            assertTrue(↵

30

                "test5", value == (900000 * 34) ↵

30

                "test6", value == (900000 * 34 * 2) ↵

31

                && expectedReverted.getTime().getTime() == reverted.getTime()↵

31

                && expectedReverted.getTime().getTime() == reverted.getTime()↵

32

            );↵

32

            );↵

33

            TimeZone.setDefault(savedZone);↵

33

            TimeZone.setDefault(savedZone);↵

34

34

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 0
Number of refactorable cases | 0
Number of non-refactorable cases | 0
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0
Clones location |
Number of node comparisons | 0