Permalink
Browse files

[JBMAR-144] Test

  • Loading branch information...
dmlloyd committed Jan 17, 2013
1 parent fc615cd commit 421e9820663167246a1325376ecf0979cafeb9e2
Showing with 13 additions and 12 deletions.
  1. +13 −12 tests/src/test/java/org/jboss/test/marshalling/SimpleMarshallerTests.java
@@ -2772,19 +2772,20 @@ public void runRead(final Unmarshaller unmarshaller) throws Throwable {
@Test
public void testTreeSetBackref() throws Throwable {
final TreeSet<TreeSetSelfRef> set = new TreeSet<TreeSetSelfRef>();
- set.add(new TreeSetSelfRef(1, set));
- set.add(new TreeSetSelfRef(4, set));
- set.add(new TreeSetSelfRef(7, set));
- set.add(new TreeSetSelfRef(8, set));
+ final TreeSetSelfRef item = new TreeSetSelfRef("1", set);
+ set.add(item);
+ set.add(new TreeSetSelfRef("4", set));
+ set.add(new TreeSetSelfRef("7", set));
+ set.add(new TreeSetSelfRef("8", set));
runReadWriteTest(new ReadWriteTest() {
public void runWrite(final Marshaller marshaller) throws Throwable {
- marshaller.writeObject(set);
- marshaller.writeObject(set);
+ marshaller.writeObject(item);
+ marshaller.writeObject(item);
}
public void runRead(final Unmarshaller unmarshaller) throws Throwable {
- final TreeSet treeSet = unmarshaller.readObject(TreeSet.class);
- assertSame(treeSet, unmarshaller.readObject(TreeSet.class));
+ final TreeSetSelfRef thing = unmarshaller.readObject(TreeSetSelfRef.class);
+ assertSame(thing, unmarshaller.readObject(TreeSetSelfRef.class));
}
});
}
@@ -2793,16 +2794,16 @@ public void runRead(final Unmarshaller unmarshaller) throws Throwable {
private static final long serialVersionUID = 1L;
- private final int foo;
+ private final String zap;
private final TreeSet<TreeSetSelfRef> parent;
- private TreeSetSelfRef(final int foo, final TreeSet<TreeSetSelfRef> parent) {
- this.foo = foo;
+ private TreeSetSelfRef(final String zap, final TreeSet<TreeSetSelfRef> parent) {
+ this.zap = zap;
this.parent = parent;
}
public int compareTo(final TreeSetSelfRef o) {
- return Integer.signum(foo - o.foo);
+ return zap.compareTo(o.zap);
}
}

0 comments on commit 421e982

Please sign in to comment.