コード例 #1
0
  @Test
  public void canRemoveJourneyFromApplication() {
    Application found = dao.findByName(TEST_APP);
    found.add(new Journey("j1", 12, 4));
    found.add(new Journey("j2", 12, 4));
    dao.update(found);

    Application toDeleteFrom = dao.findByName(TEST_APP);
    toDeleteFrom.removeJourneNamed("j2");
    dao.update(found);
  }
コード例 #2
0
  @Test
  public void removingJourneysFromOneApplicaionDoesNotRemoveFromTheOther() {
    Application a = new Application("second");
    a.add(new Journey("j1", 2, 3));
    a.add(new Journey("j2", 2, 3));
    dao.create(a);
    Application found = dao.findByName(TEST_APP);
    found.add(new Journey("j1", 2, 3));
    found.add(new Journey("j2", 2, 3));
    dao.update(found);
    Application found2 = dao.findByName("second");
    found2.removeJourneNamed("j2");
    dao.update(found2);

    found = dao.findByName(TEST_APP);
    found2 = dao.findByName("second");
    assertEquals(2, found.journeyCount());
    assertEquals(1, found2.journeyCount());
  }