}
@Test
public void testCircularReferences() throws Exception {
Name bob = new Name("Bob", "Bobby", "Bobson");
Person me = new Person("me", bob);
Person bff = new Person("bff", bob);
me.setBestFriend(bff);
bff.setBestFriend(me);
Person mom = new Person("mom");
Person dad = new Person("dad");
mom.setBestFriend(dad);
dad.setBestFriend(mom);
me.getRelatives().add(mom);
me.getRelatives().add(dad);
mom.getRelatives().add(me);
dad.getRelatives().add(me);
me = serDeser(me, Person.class);
bff = me.getBestFriend();
Iterator<Person> parents = me.getRelatives().iterator();
mom = parents.next();
dad = parents.next();
Assert.assertEquals("me", me.getNickName());
Assert.assertEquals("Bob", me.getFullName().getFirst());
Assert.assertEquals("bff", bff.getNickName());
Assert.assertSame(me.getFullName(), bff.getFullName());
Assert.assertEquals("mom", mom.getNickName());
Assert.assertEquals("dad", dad.getNickName());
Assert.assertSame(me, me.getBestFriend().getBestFriend());
Assert.assertSame(bff, bff.getBestFriend().getBestFriend());
Assert.assertSame(me.getFullName(), me.getBestFriend().getBestFriend().getFullName());
Assert.assertSame(mom, mom.getBestFriend().getBestFriend());
Assert.assertSame(dad, dad.getBestFriend().getBestFriend());
Assert.assertSame(me, mom.getRelatives().iterator().next());
Assert.assertSame(me, dad.getRelatives().iterator().next());
}