1 41 42 package org.jfree.chart.plot.junit; 43 44 import java.io.ByteArrayInputStream ; 45 import java.io.ByteArrayOutputStream ; 46 import java.io.ObjectInput ; 47 import java.io.ObjectInputStream ; 48 import java.io.ObjectOutput ; 49 import java.io.ObjectOutputStream ; 50 51 import junit.framework.Test; 52 import junit.framework.TestCase; 53 import junit.framework.TestSuite; 54 55 import org.jfree.chart.plot.ContourPlot; 56 57 60 public class ContourPlotTests extends TestCase { 61 62 67 public static Test suite() { 68 return new TestSuite(ContourPlotTests.class); 69 } 70 71 76 public ContourPlotTests(String name) { 77 super(name); 78 } 79 80 83 public void testSerialization() { 84 85 ContourPlot p1 = new ContourPlot(null, null, null, null); 86 ContourPlot p2 = null; 87 88 try { 89 ByteArrayOutputStream buffer = new ByteArrayOutputStream (); 90 ObjectOutput out = new ObjectOutputStream (buffer); 91 out.writeObject(p1); 92 out.close(); 93 94 ObjectInput in = new ObjectInputStream ( 95 new ByteArrayInputStream (buffer.toByteArray()) 96 ); 97 p2 = (ContourPlot) in.readObject(); 98 in.close(); 99 } 100 catch (Exception e) { 101 System.out.println(e.toString()); 102 } 103 assertEquals(p1, p2); 104 105 } 106 107 } 108 | Popular Tags |