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