use of org.apache.cayenne.testdo.map_to_many.IdMapToMany in project cayenne by apache.
the class CDOMapRelationshipIT method testReadToManyId.
@Test
public void testReadToManyId() throws Exception {
createTestIdDataSet();
IdMapToMany o1 = Cayenne.objectForPK(context, IdMapToMany.class, 1);
Map targets = o1.getTargets();
assertTrue(((ValueHolder) targets).isFault());
assertNotNull(targets);
assertEquals(3, targets.size());
assertNotNull(targets.get(new Integer(1)));
assertNotNull(targets.get(new Integer(2)));
assertNotNull(targets.get(new Integer(3)));
assertEquals(1, Cayenne.intPKForObject((Persistent) targets.get(new Integer(1))));
assertEquals(2, Cayenne.intPKForObject((Persistent) targets.get(new Integer(2))));
assertEquals(3, Cayenne.intPKForObject((Persistent) targets.get(new Integer(3))));
}
Aggregations