context.currentSnapshot(src2);
assertTrue(src2.readPropertyDirectly("toOneToFK") instanceof Fault);
}
public void testDelete() throws Exception {
ToOneFK2 src = context.newObject(ToOneFK2.class);
ToOneFK1 target = context.newObject(ToOneFK1.class);
src.setToOneToFK(target);
context.commitChanges();
src.setToOneToFK(null);
context.deleteObjects(target);
context.commitChanges();
// test database data
ObjectIdQuery refetch = new ObjectIdQuery(
src.getObjectId(),
false,
ObjectIdQuery.CACHE_REFRESH);
ToOneFK2 src2 = (ToOneFK2) Cayenne.objectForQuery(context1, refetch);
assertNull(src.getToOneToFK());
assertEquals(src.getObjectId(), src2.getObjectId());
}