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.ItemLabelPosition; 52 53 58 public class ItemLabelPositionTests extends TestCase { 59 60 65 public static Test suite() { 66 return new TestSuite(ItemLabelPositionTests.class); 67 } 68 69 74 public ItemLabelPositionTests(String name) { 75 super(name); 76 } 77 78 81 public void testEquals() { 82 ItemLabelPosition p1 = new ItemLabelPosition(); 83 ItemLabelPosition p2 = new ItemLabelPosition(); 84 assertEquals(p1, p2); 85 } 86 87 90 public void testSerialization() { 91 92 ItemLabelPosition p1 = new ItemLabelPosition(); 93 ItemLabelPosition p2 = null; 94 95 try { 96 ByteArrayOutputStream buffer = new ByteArrayOutputStream (); 97 ObjectOutput out = new ObjectOutputStream (buffer); 98 out.writeObject(p1); 99 out.close(); 100 101 ObjectInput in = new ObjectInputStream (new ByteArrayInputStream (buffer.toByteArray())); 102 p2 = (ItemLabelPosition) in.readObject(); 103 in.close(); 104 } 105 catch (Exception e) { 106 System.out.println(e.toString()); 107 } 108 assertEquals(p1, p2); 109 110 } 111 112 } 113 | Popular Tags |