コード例 #1
0
  @Test
  public void testReturnMovie() {
    // TODO: things still need to be sorted out with how borrower
    // ids are handles here and there.
    TestUtility.executeInserts();

    DBMovie dieHard = new DBMovie();
    dieHard.setId(1);
    dieHard.getTitle();
    H2PersonDAO.getInstance().returnMovie(dieHard);
    H2MovieDAO.getInstance().getMovieInfo(dieHard);
    assertTrue(dieHard.getBorrower() == null);
  }
コード例 #2
0
  @Test
  public void testBorrowMovie() {
    TestUtility.executeInserts();

    // setup people and movie
    DBPerson kyle = new DBPerson();
    kyle.setId(3);
    DBMovie dieHard = new DBMovie();
    dieHard.setId(1);

    // borrow die hard to kyle
    H2PersonDAO.getInstance().borrowMovie(kyle, dieHard);
    H2MovieDAO.getInstance().updateMovie(dieHard);

    assertTrue(((DBPerson) dieHard.getBorrower()).getId() == kyle.getId());
  }