Fixtures.delete(CompositeIdEntity.class, CompositeIdForeignA.class, CompositeIdForeignB.class);
}
@Test
public void testGetId() {
Factory factory = Model.Manager.factoryFor(CompositeIdEntity.class);
assertNotNull(factory);
CompositeIdForeignA a = new CompositeIdForeignA();
a.save();
CompositeIdForeignB b = new CompositeIdForeignB();
b.save();
CompositeIdEntity e = new CompositeIdEntity();
e.compositeIdForeignA = a;
e.compositeIdForeignB = b;
e.save();
// let's get its key
Object id = factory.keyValue(e);
assertNotNull(id);
assertTrue(id instanceof CompositeIdPk);
CompositeIdPk pk = (CompositeIdPk) id;
assertEquals(a.id, pk.getCompositeIdForeignA());
assertEquals(b.id, pk.getCompositeIdForeignB());