/** * Two objects that are equal are required to return the same hashCode. */ public void testHashCode() { XYBoxAnnotation a1 = new XYBoxAnnotation( 1.0, 2.0, 3.0, 4.0, new BasicStroke(1.2f), Color.red, Color.blue ); XYBoxAnnotation a2 = new XYBoxAnnotation( 1.0, 2.0, 3.0, 4.0, new BasicStroke(1.2f), Color.red, Color.blue ); assertTrue(a1.equals(a2)); int h1 = a1.hashCode(); int h2 = a2.hashCode(); assertEquals(h1, h2); }
/** * Two objects that are equal are required to return the same hashCode. */ public void testHashCode() { XYBoxAnnotation a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(1.2f), Color.red, Color.blue); XYBoxAnnotation a2 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(1.2f), Color.red, Color.blue); assertTrue(a1.equals(a2)); int h1 = a1.hashCode(); int h2 = a2.hashCode(); assertEquals(h1, h2); }
/** * Draws the chart with a <code>null</code> info object to make sure that * no exceptions are thrown. */ public void testDrawWithNullInfo() { boolean success = false; try { DefaultTableXYDataset dataset = new DefaultTableXYDataset(); XYSeries s1 = new XYSeries("Series 1", true, false); s1.add(5.0, 5.0); s1.add(10.0, 15.5); s1.add(15.0, 9.5); s1.add(20.0, 7.5); dataset.addSeries(s1); XYSeries s2 = new XYSeries("Series 2", true, false); s2.add(5.0, 5.0); s2.add(10.0, 15.5); s2.add(15.0, 9.5); s2.add(20.0, 3.5); dataset.addSeries(s2); XYPlot plot = new XYPlot(dataset, new NumberAxis("X"), new NumberAxis("Y"), new XYLineAndShapeRenderer()); plot.addAnnotation(new XYBoxAnnotation(10.0, 12.0, 3.0, 4.0, new BasicStroke(1.2f), Color.red, Color.blue)); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, null); success = true; } catch (NullPointerException e) { e.printStackTrace(); success = false; } assertTrue(success); }
/** * Checks that this class implements PublicCloneable. */ public void testPublicCloneable() { XYBoxAnnotation a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(1.2f), Color.red, Color.blue); assertTrue(a1 instanceof PublicCloneable); }