@Test public void testMergeTwoStrings() throws Exception { c1.setFirstName("Ian"); c2.setLastName("Darwin"); result = (Person) ObjectMerge.merge(c1, c2); assertEquals("Merge Nulls", "Ian Darwin", result.toString()); }
@Test public void testMergeOneString() throws Exception { c1.setFirstName("ABC"); c2.setFirstName(null); result = (Person) ObjectMerge.merge(c2, c1); assertEquals("One String", "ABC", result.getFirstName()); }
@Test public void testTransitivity() throws Exception { c1.setFirstName("Robin"); assertTrue("Transitivity test", ObjectMerge.merge(c1, c2).equals(ObjectMerge.merge(c2, c1))); }
@Test public void testMergeInts() throws Exception { c1.setId(42L); result = (Person) ObjectMerge.merge(c1, c1); assertEquals("Merge Integers", Long.valueOf(42), result.getId()); }