public class ItemLabelPositionTests extends TestCase { /** * Returns the tests as a test suite. * * @return The test suite. */ public static Test suite() { return new TestSuite(ItemLabelPositionTests.class); } /** * Constructs a new set of tests. * * @param name the name of the tests. */ public ItemLabelPositionTests(String name) { super(name); } /** * Check that the equals() method distinguishes all fields. */ public void testEquals() { ItemLabelPosition p1 = new ItemLabelPosition(); ItemLabelPosition p2 = new ItemLabelPosition(); assertEquals(p1, p2); } /** * Serialize an instance, restore it, and check for equality. */ public void testSerialization() { ItemLabelPosition p1 = new ItemLabelPosition(); ItemLabelPosition p2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(p1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); p2 = (ItemLabelPosition) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(p1, p2)
public class StandardXYURLGeneratorTests extends TestCase { /** * Returns the tests as a test suite. * * @return The test suite. */ public static Test suite() { return new TestSuite(StandardXYURLGeneratorTests.class); } /** * Constructs a new set of tests. * * @param name the name of the tests. */ public StandardXYURLGeneratorTests(String name) { super(name); } /** * Serialize an instance, restore it, and check for equality. */ public void testSerialization() { StandardXYURLGenerator g1 = new StandardXYURLGenerator("index.html?"); StandardXYURLGenerator g2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(g1); out.close(); ObjectInput in = new ObjectInputStream(new ByteArrayInputStream( buffer.toByteArray())); g2 = (StandardXYURLGenerator) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(g1, g2); } /** * Checks that the class does not implement PublicCloneable (the generator * is immutable). */ public void testPublicCloneable() { StandardXYURLGenerator g1 = new StandardXYURLGenerator("index.html?"); assertFalse(g1 instanceof PublicCloneable)
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/labels/junit/ItemLabelPositionTests.java File path: /jfreechart-1.0.10/tests/org/jfree/chart/urls/junit/StandardXYURLGeneratorTests.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public class ItemLabelPositionTests extends TestCase {
1
public class StandardXYURLGeneratorTests extends TestCase {
2
    /**
2
    /**
3
     * Returns the tests as a test suite.
3
     * Returns the tests as a test suite.
4
     *
4
     *
5
     * @return The test suite.
5
     * @return The test suite.
6
     */
6
     */
7
    public static Test suite() {
7
    public static Test suite() {
8
        return new TestSuite(ItemLabelPositionTests.class);
8
        return new TestSuite(StandardXYURLGeneratorTests.class);
9
    }
9
    }
10
    /**
10
    /**
11
     * Constructs a new set of tests.
11
     * Constructs a new set of tests.
12
     *
12
     *
13
     * @param name  the name of the tests.
13
     * @param name  the name of the tests.
14
     */
14
     */
15
    public ItemLabelPositionTests(String name) {
15
    public StandardXYURLGeneratorTests(String name) {
16
        super(name);
16
        super(name);
17
    }
17
    }
18
    /**
19
     * Check that the equals() method distinguishes all fields.
20
     */
21
    public void testEquals() {
22
        ItemLabelPosition p1 = new ItemLabelPosition();
23
        ItemLabelPosition p2 = new ItemLabelPosition();
24
        assertEquals(p1, p2);
25
    }
26
    /**
18
    /**
27
     * Serialize an instance, restore it, and check for equality.
19
     * Serialize an instance, restore it, and check for equality.
28
     */
20
     */
29
    public void testSerialization() {
21
    public void testSerialization() {
30
        ItemLabelPosition p1 = new ItemLabelPosition();
22
        
31
        ItemLabelPosition p
23
StandardXYURLGenerator g1 = new StandardXYURLGenerator("index.html?");
32
2 = null;
24
        StandardXYURLGenerator g2 = null;
33
        try {
25
        try {
34
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
26
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
35
            ObjectOutput out = new ObjectOutputStream(buffer);
27
            ObjectOutput out = new ObjectOutputStream(buffer);
36
            out.writeObject(p1);
28
            out.writeObject(g1);
37
            out.close();
29
            out.close();
38
            ObjectInput in = new ObjectInputStream(
30
            ObjectInput in = new ObjectInputStream(
39
                    new ByteArrayInputStream(
31
new ByteArrayInputStream(
40
buffer.toByteArray()));
32
                    buffer.toByteArray()));
41
            p2 = (ItemLabelPosition) in.readObject();
33
            g2 = (StandardXYURLGenerator) in.readObject();
42
            in.close();
34
            in.close();
43
        }
35
        }
44
        catch (Exception e) {
36
        catch (Exception e) {
45
            e.printStackTrace();
37
            e.printStackTrace();
46
        }
38
        }
47
        assertEquals(p1, p2
39
        assertEquals(g1, g2);
40
    }
41
    /**
42
     * Checks that the class does not implement PublicCloneable (the generator
43
     * is immutable).
44
     */
45
    public void testPublicCloneable() {
46
        StandardXYURLGenerator g1 = new StandardXYURLGenerator("index.html?");
48
)
47
        assertFalse(g1 instanceof PublicCloneable)
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