}
public void testRemoveToMany() throws Exception {
createTestData("prepare");
SetToMany o1 = DataObjectUtils.objectForPK(
createDataContext(),
SetToMany.class,
1);
Set targets = o1.getTargets();
assertEquals(3, targets.size());
SetToManyTarget target = DataObjectUtils.objectForPK(o1
.getObjectContext(), SetToManyTarget.class, 2);
o1.removeFromTargets(target);
assertEquals(2, targets.size());
assertFalse(o1.getTargets().contains(target));
assertNull(target.getSetToMany());
o1.getObjectContext().commitChanges();
o1.getObjectContext().performGenericQuery(new RefreshQuery());
assertEquals(2, o1.getTargets().size());
assertFalse(o1.getTargets().contains(target));
}