diff.apply(diffChecker);
assertEquals(1, diffChecker.getCallbackCount());
assertSame(a.getObjectId(), newIds[0]);
// commit a mix of new and modified
Painting p = context.newObject(Painting.class);
p.setPaintingTitle("PT");
p.setToArtist(a);
a.setArtistName(a.getArtistName() + "_");
GraphDiff diff2 = context.flushToParent(true);
assertNotNull(diff2);
assertFalse(context.hasChanges());
final Object[] newIds2 = new Object[1];
MockGraphChangeHandler diffChecker2 = new MockGraphChangeHandler() {
@Override
public void nodeIdChanged(Object nodeId, Object newId) {
super.nodeIdChanged(nodeId, newId);
newIds2[0] = newId;
}
};
diff2.apply(diffChecker2);
assertEquals(1, diffChecker2.getCallbackCount());
assertSame(p.getObjectId(), newIds2[0]);
}