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