@Test public void testRemoveList() { TestUtility.executeInserts(); H2ListsDAO.getInstance().removeList("Action Marathon"); assertTrue(H2ListsDAO.getInstance().getAllLists().size() == 0); }
@Test public void testAddMovieToList() { TestUtility.executeInserts(); H2ListsDAO.getInstance() .addMovieToList( "Action Marathon", H2ListsDAO.getInstance().getMoviesInList("Action Marathon").get(0)); List<Movie> movies = H2ListsDAO.getInstance().getMoviesInList("Action Marathon"); assertEquals(3, movies.size()); assertEquals("Die Hard", movies.get(0).getTitle()); assertEquals("Die Hard: With a Vengeance", movies.get(1).getTitle()); assertEquals("Die Hard", movies.get(2).getTitle()); }
@Test public void testReorderMoviesInList() { TestUtility.executeInserts(); // get the movies and reorder them List<Movie> movies = H2ListsDAO.getInstance().getMoviesInList("Action Marathon"); ArrayList<Movie> newMoviesList = new ArrayList<Movie>(); newMoviesList.add(movies.get(1)); newMoviesList.add(movies.get(0)); H2ListsDAO.getInstance().reorderMoviesInList("Action Marathon", newMoviesList); List<Movie> moviesAgain = H2ListsDAO.getInstance().getMoviesInList("Action Marathon"); assertEquals("Die Hard: With a Vengeance", moviesAgain.get(0).getTitle()); assertEquals("Die Hard", moviesAgain.get(1).getTitle()); }
@Test public void testGetAllLists() { TestUtility.executeInserts(); List<String> lists = H2ListsDAO.getInstance().getAllLists(); assertTrue(lists.size() == 1); assertTrue(lists.contains("Action Marathon")); }