/** * Confirm that the equals method can distinguish all the required fields. */ public void testEquals() { VectorSeries s1 = new VectorSeries("Series"); s1.add(1.0, 1.1, 1.2, 1.3); VectorSeriesCollection c1 = new VectorSeriesCollection(); c1.addSeries(s1); VectorSeries s2 = new VectorSeries("Series"); s2.add(1.0, 1.1, 1.2, 1.3); VectorSeriesCollection c2 = new VectorSeriesCollection(); c2.addSeries(s2); assertTrue(c1.equals(c2)); assertTrue(c2.equals(c1)); c1.addSeries(new VectorSeries("Empty Series")); assertFalse(c1.equals(c2)); c2.addSeries(new VectorSeries("Empty Series")); assertTrue(c1.equals(c2)); }
/** * Some checks for the removeSeries() method. */ public void testRemoveSeries() { VectorSeries s1 = new VectorSeries("S1"); VectorSeries s2 = new VectorSeries("S2"); VectorSeriesCollection vsc = new VectorSeriesCollection(); vsc.addSeries(s1); vsc.addSeries(s2); assertEquals(2, vsc.getSeriesCount()); boolean b = vsc.removeSeries(s1); assertTrue(b); assertEquals(1, vsc.getSeriesCount()); assertEquals("S2", vsc.getSeriesKey(0)); b = vsc.removeSeries(new VectorSeries("NotInDataset")); assertFalse(b); assertEquals(1, vsc.getSeriesCount()); b = vsc.removeSeries(s2); assertTrue(b); assertEquals(0, vsc.getSeriesCount()); }
/** * Verify that this class implements {@link PublicCloneable}. */ public void testPublicCloneable() { VectorSeriesCollection d1 = new VectorSeriesCollection(); assertTrue(d1 instanceof PublicCloneable); }