@Test public void testSaveParent() { Parent parent = new Parent("xpto"); yawp.save(parent); Parent retrievedParent = parent.getId().fetch(); assertEquals("xpto", retrievedParent.getName()); }
@Test public void testSaveChild() { Parent parent = new Parent(); yawp.save(parent); Child child = new Child("xpto"); child.setParentId(parent.getId()); yawp.save(child); Parent retrievedParent = parent.getId().fetch(); Child retrievedChild = child.getId().fetch(); assertEquals(retrievedChild.getParentId(), retrievedParent.getId()); assertEquals("xpto", retrievedChild.getName()); }