Search in sources :

Example 1 with IdMapToMany

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))));
}
Also used : IdMapToMany(org.apache.cayenne.testdo.map_to_many.IdMapToMany) Map(java.util.Map) Test(org.junit.Test)

Aggregations

Map (java.util.Map)1 IdMapToMany (org.apache.cayenne.testdo.map_to_many.IdMapToMany)1 Test (org.junit.Test)1