@Test
public void testMergeObjects() {

    try {
        admin.mergeObjects(Arrays.asList(new Grandfather("bogus")));
    } catch (AbortRuntimeException e) {
        // don't know if schema or instances were invalid from
        // a HTTP 404 response, hence CFG090 and not CFG101/CDG304
        assertThat(e.getEvent().getCode(), is(CFG090));
    }
    admin.createObjects(grandfathers);
    // assert successful create
    Optional<Grandfather> optional = admin.get(Grandfather.class, "g1");
    assertTrue(optional.isPresent());
    Grandfather g1 = new Grandfather("g1");
    g1.setProp1("testSetObjects1");
    Grandfather g2 = new Grandfather("g2");
    g2.setProp1("testSetObjects2");
    admin.mergeObjects(Arrays.asList(g1, g2));
    // test g1
    optional = admin.get(Grandfather.class, "g1");
    assertTrue(optional.isPresent());
    // assert that new value have been set
    assertThat(optional.get().getProp1(), is("testSetObjects1"));
    // assert that previously set value have been reset
    assertNotNull(optional.get().getProp9());
    // test g2
    optional = admin.get(Grandfather.class, "g2");
    assertTrue(optional.isPresent());
    // assert that new value have been set
    assertThat(optional.get().getProp1(), is("testSetObjects2"));
    // assert that previously set value have been reset
    assertNotNull(optional.get().getProp2());
}