Java Code Examples for org.jfree.chart.TestUtilities#serialised()

The following examples show how to use org.jfree.chart.TestUtilities#serialised() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CandlestickRendererTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for equality.
 */
@Test
public void testSerialization() {
    CandlestickRenderer r1 = new CandlestickRenderer();
    CandlestickRenderer r2 = (CandlestickRenderer) 
            TestUtilities.serialised(r1);
    assertEquals(r1, r2);
}
 
Example 2
Source File: HighLowItemLabelGeneratorTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for equality.
 */
@Test
public void testSerialization() {
    HighLowItemLabelGenerator g1 = new HighLowItemLabelGenerator();
    HighLowItemLabelGenerator g2 = (HighLowItemLabelGenerator) 
            TestUtilities.serialised(g1);
    assertEquals(g1, g2);
}
 
Example 3
Source File: ClusteredXYBarRendererTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for equality.
 */
@Test
public void testSerialization() {
    ClusteredXYBarRenderer r1 = new ClusteredXYBarRenderer();
    ClusteredXYBarRenderer r2 = (ClusteredXYBarRenderer) 
            TestUtilities.serialised(r1);
    assertEquals(r1, r2);
}
 
Example 4
Source File: DateAxisTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for equality.
 */
@Test
public void testSerialization() {
    DateAxis a1 = new DateAxis("Test Axis");
    DateAxis a2 = (DateAxis) TestUtilities.serialised(a1);
    assertEquals(a1, a2);
}
 
Example 5
Source File: PolarPlotTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for equality.
 */
@Test
public void testSerialization() {
    PolarPlot p1 = new PolarPlot();
    p1.setAngleGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f,
            4.0f, Color.blue));
    p1.setAngleLabelPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f,
            4.0f, Color.blue));
    p1.setRadiusGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f,
            4.0f, Color.blue));
    PolarPlot p2 = (PolarPlot) TestUtilities.serialised(p1);
    assertEquals(p1, p2);
}
 
Example 6
Source File: CrosshairOverlayTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for equality.
 */
@Test
public void testSerialization() {
    CrosshairOverlay o1 = new CrosshairOverlay();
    o1.addDomainCrosshair(new Crosshair(99.9));
    o1.addRangeCrosshair(new Crosshair(1.23, new GradientPaint(1.0f, 2.0f,
            Color.red, 3.0f, 4.0f, Color.blue), new BasicStroke(1.1f)));
    CrosshairOverlay o2 = (CrosshairOverlay) TestUtilities.serialised(o1);
    assertEquals(o1, o2);
}
 
Example 7
Source File: DefaultKeyedValuesDatasetTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for equality.
 */
public void testSerialization() {
    DefaultKeyedValuesDataset d1 = new DefaultKeyedValuesDataset();
    d1.setValue("C1", new Double(234.2));
    d1.setValue("C2", null);
    d1.setValue("C3", new Double(345.9));
    d1.setValue("C4", new Double(452.7));

    KeyedValuesDataset d2 = (KeyedValuesDataset) 
            TestUtilities.serialised(d1);
    assertEquals(d1, d2);
}
 
Example 8
Source File: YIntervalSeriesTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for equality.
 */
@Test
public void testSerialization() {
    YIntervalSeries s1 = new YIntervalSeries("s1");
    s1.add(1.0, 0.5, 1.5, 2.0);
    YIntervalSeries s2 = (YIntervalSeries) TestUtilities.serialised(s1);
    assertEquals(s1, s2);
}
 
Example 9
Source File: DefaultKeyedValuesTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for equality.
 */
@Test
public void testSerialization() {
    DefaultKeyedValues v1 = new DefaultKeyedValues();
    v1.addValue("Key 1", new Double(23));
    v1.addValue("Key 2", null);
    v1.addValue("Key 3", new Double(42));

    DefaultKeyedValues v2 = (DefaultKeyedValues) 
            TestUtilities.serialised(v1);
    assertEquals(v1, v2);
}
 
Example 10
Source File: PaintScaleLegendTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for equality.
 */
@Test
public void testSerialization() {
    PaintScaleLegend l1 = new PaintScaleLegend(new GrayPaintScale(),
            new NumberAxis("X"));
    PaintScaleLegend l2 = (PaintScaleLegend) TestUtilities.serialised(l1);
    assertEquals(l1, l2);
}
 
Example 11
Source File: BarRenderer3DTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for equality.
 */
@Test
public void testSerialization() {
    BarRenderer3D r1 = new BarRenderer3D();
    r1.setWallPaint(new GradientPaint(1.0f, 2.0f, Color.red, 4.0f, 3.0f,
            Color.blue));
    BarRenderer3D r2 = (BarRenderer3D) TestUtilities.serialised(r1);
    assertEquals(r1, r2);
}
 
Example 12
Source File: PolynomialFunction2DTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for equality.
 */
@Test
public void testSerialization() {
    PolynomialFunction2D f1 = new PolynomialFunction2D(new double[] {1.0,
            2.0});
    PolynomialFunction2D f2 = (PolynomialFunction2D) 
            TestUtilities.serialised(f1);
    assertEquals(f1, f2);
}
 
Example 13
Source File: StandardPieURLGeneratorTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for equality.
 */
@Test
public void testSerialization() {
    StandardPieURLGenerator g1 = new StandardPieURLGenerator(
            "index.html?", "cat");
    StandardPieURLGenerator g2 = (StandardPieURLGenerator) 
            TestUtilities.serialised(g1);
    assertEquals(g1, g2);
}
 
Example 14
Source File: HistogramDatasetTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for equality.
 */
@Test
public void testSerialization() {
    double[] values = {1.0, 2.0, 3.0, 4.0, 6.0, 12.0, 5.0, 6.3, 4.5};
    HistogramDataset d1 = new HistogramDataset();
    d1.addSeries("Series 1", values, 5);
    HistogramDataset d2 = (HistogramDataset) TestUtilities.serialised(d1);
    assertEquals(d1, d2);

    // simple check for independence
    d1.addSeries("Series 2", new double[] {1.0, 2.0, 3.0}, 2);
    assertFalse(d1.equals(d2));
    d2.addSeries("Series 2", new double[] {1.0, 2.0, 3.0}, 2);
    assertTrue(d1.equals(d2));
}
 
Example 15
Source File: LegendItemEntityTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for equality.
 */
@Test
public void testSerialization() {
    LegendItemEntity e1 = new LegendItemEntity(new Rectangle2D.Double(1.0,
            2.0, 3.0, 4.0));
    LegendItemEntity e2 = (LegendItemEntity) TestUtilities.serialised(e1);
    assertEquals(e1, e2);
}
 
Example 16
Source File: XYBlockRendererTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for equality.
 */
@Test
public void testSerialization() {
    XYBlockRenderer r1 = new XYBlockRenderer();
    XYBlockRenderer r2 = (XYBlockRenderer) TestUtilities.serialised(r1);
    assertEquals(r1, r2);
}
 
Example 17
Source File: DefaultCategoryDatasetTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for equality.
 */
public void testSerialization() {
    DefaultCategoryDataset d1 = new DefaultCategoryDataset();
    d1.setValue(23.4, "R1", "C1");
    DefaultCategoryDataset d2 = (DefaultCategoryDataset) 
            TestUtilities.serialised(d1);
    assertEquals(d1, d2);
}
 
Example 18
Source File: CyclicNumberAxisTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for equality.
 */
@Test
public void testSerialization() {
    CyclicNumberAxis a1 = new CyclicNumberAxis(10, 0, "Test Axis");
    CyclicNumberAxis a2 = (CyclicNumberAxis) TestUtilities.serialised(a1);
    assertEquals(a1, a2);
}
 
Example 19
Source File: CategoryLabelPositionTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for equality.
 */
@Test
public void testSerialization() {
    CategoryLabelPosition p1 = new CategoryLabelPosition();
    CategoryLabelPosition p2 = (CategoryLabelPosition) TestUtilities.serialised(p1);
    assertEquals(p1, p2);
}
 
Example 20
Source File: PlotOrientationTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for equality.
 */
@Test
public void testSerialization() {
    PlotOrientation orientation1 = PlotOrientation.HORIZONTAL;
    PlotOrientation orientation2 = (PlotOrientation) 
            TestUtilities.serialised(orientation1);
    assertEquals(orientation1, orientation2);
    boolean same = orientation1 == orientation2;
    assertEquals(true, same);
}