1 41 42 package org.jfree.chart.renderer.xy.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.renderer.category.junit.StackedAreaRendererTests; 56 import org.jfree.chart.renderer.xy.SignalRenderer; 57 58 61 public class SignalRendererTests extends TestCase { 62 63 68 public static Test suite() { 69 return new TestSuite(SignalRendererTests.class); 70 } 71 72 77 public SignalRendererTests(String name) { 78 super(name); 79 } 80 81 84 public void testSerialization() { 85 86 SignalRenderer r1 = new SignalRenderer(); 87 SignalRenderer r2 = null; 88 89 try { 90 ByteArrayOutputStream buffer = new ByteArrayOutputStream (); 91 ObjectOutput out = new ObjectOutputStream (buffer); 92 out.writeObject(r1); 93 out.close(); 94 95 ObjectInput in = new ObjectInputStream ( 96 new ByteArrayInputStream (buffer.toByteArray()) 97 ); 98 r2 = (SignalRenderer) in.readObject(); 99 in.close(); 100 } 101 catch (Exception e) { 102 System.out.println(e.toString()); 103 } 104 assertEquals(r1, r2); 105 106 } 107 108 } 109 | Popular Tags |