1 43 44 package org.jfree.chart.labels.junit; 45 46 import java.io.ByteArrayInputStream ; 47 import java.io.ByteArrayOutputStream ; 48 import java.io.ObjectInput ; 49 import java.io.ObjectInputStream ; 50 import java.io.ObjectOutput ; 51 import java.io.ObjectOutputStream ; 52 53 import junit.framework.Test; 54 import junit.framework.TestCase; 55 import junit.framework.TestSuite; 56 57 import org.jfree.chart.labels.ItemLabelPosition; 58 59 62 public class ItemLabelPositionTests extends TestCase { 63 64 69 public static Test suite() { 70 return new TestSuite(ItemLabelPositionTests.class); 71 } 72 73 78 public ItemLabelPositionTests(String name) { 79 super(name); 80 } 81 82 85 public void testEquals() { 86 ItemLabelPosition p1 = new ItemLabelPosition(); 87 ItemLabelPosition p2 = new ItemLabelPosition(); 88 assertEquals(p1, p2); 89 } 90 91 94 public void testSerialization() { 95 96 ItemLabelPosition p1 = new ItemLabelPosition(); 97 ItemLabelPosition p2 = null; 98 99 try { 100 ByteArrayOutputStream buffer = new ByteArrayOutputStream (); 101 ObjectOutput out = new ObjectOutputStream (buffer); 102 out.writeObject(p1); 103 out.close(); 104 105 ObjectInput in = new ObjectInputStream ( 106 new ByteArrayInputStream (buffer.toByteArray()) 107 ); 108 p2 = (ItemLabelPosition) in.readObject(); 109 in.close(); 110 } 111 catch (Exception e) { 112 System.out.println(e.toString()); 113 } 114 assertEquals(p1, p2); 115 116 } 117 118 } 119 | Popular Tags |