Esempio n. 1
0
  @Test
  public void testSaveParent() {
    Parent parent = new Parent("xpto");

    yawp.save(parent);

    Parent retrievedParent = parent.getId().fetch();
    assertEquals("xpto", retrievedParent.getName());
  }
Esempio n. 2
0
  @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());
  }