1 37 38 package org.jfree.chart.renderer.junit; 39 40 import java.io.ByteArrayInputStream ; 41 import java.io.ByteArrayOutputStream ; 42 import java.io.ObjectInput ; 43 import java.io.ObjectInputStream ; 44 import java.io.ObjectOutput ; 45 import java.io.ObjectOutputStream ; 46 47 import junit.framework.Test; 48 import junit.framework.TestCase; 49 import junit.framework.TestSuite; 50 51 import org.jfree.chart.renderer.SignalRenderer; 52 53 58 public class SignalRendererTests extends TestCase { 59 60 65 public static Test suite() { 66 return new TestSuite(SignalRendererTests.class); 67 } 68 69 74 public SignalRendererTests(String name) { 75 super(name); 76 } 77 78 81 public void testSerialization() { 82 83 SignalRenderer r1 = new SignalRenderer(); 84 SignalRenderer r2 = null; 85 86 try { 87 ByteArrayOutputStream buffer = new ByteArrayOutputStream (); 88 ObjectOutput out = new ObjectOutputStream (buffer); 89 out.writeObject(r1); 90 out.close(); 91 92 ObjectInput in = new ObjectInputStream (new ByteArrayInputStream (buffer.toByteArray())); 93 r2 = (SignalRenderer) in.readObject(); 94 in.close(); 95 } 96 catch (Exception e) { 97 System.out.println(e.toString()); 98 } 99 assertEquals(r1, r2); 100 101 } 102 103 } 104 | Popular Tags |