DateAxis axis = new DateAxis("Test Axis"); Date date = new Date(); axis.setMaximumDate(date); assertEquals(date, axis.getMaximumDate()); // check that setting the max date to something on or before the // current min date works... Date d1 = new Date(); Date d2 = new Date(d1.getTime() + 1); Date d0 = new Date(d1.getTime() - 1); axis.setMaximumDate(d2); axis.setMinimumDate(d1); axis.setMaximumDate(d1); assertEquals(d0, axis.getMinimumDate());
Day d1 = new Day(15, 4, 2000); Day d2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(d1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray()) ); d2 = (Day) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(d1, d2);
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/DateAxisTests.java File path: /jfreechart-1.0.10/tests/org/jfree/data/time/junit/DayTests.java
Method name: void testSetMaximumDate() Method name: void testSerialization()
Number of AST nodes: 11 Number of AST nodes: 11
1
DateAxis axis = new DateAxis("Test Axis");
1
Da
2
        Date date = new Date();
3
        axis.setMaximumDate(date);
4
        assertEquals(date, axis.getMaximumDate
2
y d1 = new Day(15, 4, 2000);
3
        Day d2 = null;
4
        try {
5
());
5
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
6
        // check that setting the max date to something on or before the 
6
         
7
        // current min date works...
8
        Date d1 = new Date();
9
        Date d2 = new Date(d1.getTime() + 1
7
   ObjectOutput out = new ObjectOutputStream(buffer);
8
            out.writeObject(d1);
9
            out.close();
10
            ObjectInput in = new ObjectInputStream(
11
                new ByteArrayInputStream(buffer.toByteArray())
10
);
12
            );
11
        Date d0 = new Date(d1.getTime() - 1);
13
            d2 = 
12
        axis.setMaximumDate(d2);
13
        axis.setMinimumDate(d1);
14
        axis.setMaximumDate(d1);
14
(Day) in.readObject();
15
            in.close();
16
        }
17
        catch (Exception e) {
18
            System.out.println(e.toString());
19
        }
15
        assertEquals(d0, axis.getMinimumDate());
20
        assertEquals(d1, d2);
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 locationClones are in different classes having the same super class
Number of node comparisons33