@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); }
@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()); }