1 | public class StandardTickUnitSourceTests extends TestCase {↵ | | 1 | public class ItemLabelPositionTests extends TestCase {↵
|
|
2 | /**↵ | | 2 | /**↵
|
3 | * Returns the tests as a test suite.↵ | | 3 | * Returns the tests as a test suite.↵
|
4 | *↵ | | 4 | *↵
|
5 | * @return The test suite.↵ | | 5 | * @return The test suite.↵
|
6 | */↵ | | 6 | */↵
|
7 | public static Test suite() {↵ | | 7 | public static Test suite() {↵
|
8 | return new TestSuite(StandardTickUnitSourceTests.class);↵ | | 8 | return new TestSuite(ItemLabelPositionTests.class);↵
|
9 | }↵ | | 9 | }↵
|
|
10 | /**↵ | | 10 | /**↵
|
11 | * Constructs a new set of tests.↵ | | 11 | * Constructs a new set of tests.↵
|
12 | *↵ | | 12 | *↵
|
13 | * @param name the name of the tests.↵ | | 13 | * @param name the name of the tests.↵
|
14 | */↵ | | 14 | */↵
|
15 | public StandardTickUnitSourceTests(String name) {↵ | | 15 | public ItemLabelPositionTests(String name) {↵
|
16 | super(name);↵ | | 16 | super(name);↵
|
17 | }↵ | | 17 | }↵
|
|
18 | /**↵ | | 18 | /**↵
|
19 | * Confirm that the equals method can distinguish all the required fields.↵ | | 19 | * Check that the equals() method distinguishes all fields.↵
|
20 | */↵ | | 20 | */↵
|
21 | public void testEquals() {↵ | | 21 | public void testEquals() {↵
|
22 | StandardTickUnitSource t1 = new StandardTickUnitSource();↵ | | 22 | ↵
|
23 | StandardTickUnitSource t2 = new StandardTickUnitSource↵ | | 23 | ItemLabelPosition p1 = new ItemLabelPosition();↵
|
24 | ();↵ | | 24 | ItemLabelPosition p2 = new ItemLabelPosition();↵
|
25 | assertTrue(t1.equals(t2));↵ | | 25 | assertEquals(p1, p2);↵
|
26 | }↵ | | 26 | }↵
|
|
27 | /**↵ | | 27 | /**↵
|
28 | * Serialize an instance, restore it, and check for equality.↵ | | 28 | * Serialize an instance, restore it, and check for equality.↵
|
29 | */↵ | | 29 | */↵
|
30 | public void testSerialization() {↵ | | 30 | public void testSerialization() {↵
|
|
31 | StandardTickUnitSource t1 = new StandardTickUnitSource();↵ | | 31 | ↵
|
32 | StandardTickUnitSource t↵ | | 32 | ItemLabelPosition p1 = new ItemLabelPosition();↵
|
33 | 2 = null;↵ | | 33 | ItemLabelPosition p2 = null;↵
|
|
34 | try {↵ | | 34 | try {↵
|
35 | ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵ | | 35 | ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵
|
36 | ObjectOutput out = new ObjectOutputStream(buffer);↵ | | 36 | ObjectOutput out = new ObjectOutputStream(buffer);↵
|
37 | out.writeObject(t1);↵ | | 37 | out.writeObject(p1);↵
|
38 | out.close();↵ | | 38 | out.close();↵
|
|
39 | ObjectInput in = new ObjectInputStream(↵ | | 39 | ObjectInput in = new ObjectInputStream(↵
|
40 | new ByteArrayInputStream(↵ | | 40 | new ByteArrayInputStream(↵
|
41 | buffer.toByteArray()));↵ | | 41 | buffer.toByteArray()));↵
|
42 | t2 = (StandardTickUnitSource) in.readObject();↵ | | 42 | p2 = (ItemLabelPosition) in.readObject();↵
|
43 | in.close();↵ | | 43 | in.close();↵
|
44 | }↵ | | 44 | }↵
|
45 | catch (Exception e) {↵ | | 45 | catch (Exception e) {↵
|
46 | e.printStackTrace();↵ | | 46 | e.printStackTrace();↵
|
47 | }↵ | | 47 | }↵
|
48 | assertEquals(t1, t2) | | 48 | assertEquals(p1, p2)
|