1 41 42 package org.jfree.chart.axis.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.axis.NumberAxis3D; 56 57 60 public class NumberAxis3DTests extends TestCase { 61 62 67 public static Test suite() { 68 return new TestSuite(NumberAxis3DTests.class); 69 } 70 71 76 public NumberAxis3DTests(String name) { 77 super(name); 78 } 79 80 83 public void testSerialization() { 84 85 NumberAxis3D a1 = new NumberAxis3D("Test Axis"); 86 NumberAxis3D a2 = null; 87 88 try { 89 ByteArrayOutputStream buffer = new ByteArrayOutputStream (); 90 ObjectOutput out = new ObjectOutputStream (buffer); 91 out.writeObject(a1); 92 out.close(); 93 94 ObjectInput in = new ObjectInputStream ( 95 new ByteArrayInputStream (buffer.toByteArray()) 96 ); 97 a2 = (NumberAxis3D) in.readObject(); 98 in.close(); 99 } 100 catch (Exception e) { 101 System.out.println(e.toString()); 102 } 103 assertEquals(a1, a2); 104 105 } 106 107 } 108 | Popular Tags |