// should not throw an exception
union.toString();
}
public void testCompareTo() throws Exception {
ComparableUnion cu = ComparableUnion.string_field("a");
ComparableUnion cu2 = ComparableUnion.string_field("b");
assertTrue(cu.compareTo(cu) == 0);
assertTrue(cu2.compareTo(cu2) == 0);
assertTrue(cu.compareTo(cu2) < 0);
assertTrue(cu2.compareTo(cu) > 0);
cu2 = ComparableUnion.binary_field(ByteBuffer.wrap(new byte[]{2}));
assertTrue(cu.compareTo(cu2) < 0);
assertTrue(cu2.compareTo(cu) > 0);
cu = ComparableUnion.binary_field(ByteBuffer.wrap(new byte[]{1}));
assertTrue(cu.compareTo(cu2) < 0);
assertTrue(cu2.compareTo(cu) > 0);
TestUnion union1 = new TestUnion(TestUnion._Fields.STRUCT_LIST, new ArrayList<RandomStuff>());
TestUnion union2 = new TestUnion(TestUnion._Fields.STRUCT_LIST, new ArrayList<RandomStuff>());
assertTrue(union1.compareTo(union2) == 0);