/** * Check cloning of the urlGenerator field. */ @Test public void testCloning_URLGenerator() throws CloneNotSupportedException { CustomPieURLGenerator generator = new CustomPieURLGenerator(); PiePlot p1 = new PiePlot(); p1.setURLGenerator(generator); PiePlot p2 = (PiePlot) p1.clone(); assertTrue(p1 != p2); assertTrue(p1.getClass() == p2.getClass()); assertTrue(p1.equals(p2)); // check that the URL generator has been cloned assertTrue(p1.getURLGenerator() != p2.getURLGenerator()); }
/** * Check cloning of the legendLabelURLGenerator field. */ @Test public void testCloning_LegendLabelURLGenerator() throws CloneNotSupportedException { CustomPieURLGenerator generator = new CustomPieURLGenerator(); PiePlot p1 = new PiePlot(); p1.setLegendLabelURLGenerator(generator); PiePlot p2 = (PiePlot) p1.clone(); assertTrue(p1 != p2); assertTrue(p1.getClass() == p2.getClass()); assertTrue(p1.equals(p2)); // check that the URL generator has been cloned assertTrue(p1.getLegendLabelURLGenerator() != p2.getLegendLabelURLGenerator()); }
/** * Some checks for the equals() method. */ public void testEquals() { CustomPieURLGenerator g1 = new CustomPieURLGenerator(); CustomPieURLGenerator g2 = new CustomPieURLGenerator(); assertTrue(g1.equals(g2)); Map m1 = new HashMap(); m1.put("A", "http://www.jfree.org/"); g1.addURLs(m1); assertFalse(g1.equals(g2)); g2.addURLs(m1); assertTrue(g1.equals(g2)); }
/** * Checks that the class implements PublicCloneable. */ public void testPublicCloneable() { CustomPieURLGenerator g1 = new CustomPieURLGenerator(); assertTrue(g1 instanceof PublicCloneable); }