@Test public void testPseudoFilmList() { List<Film> expected = Arrays.asList(new Film("Test")); List<Film> notExpected = Arrays.asList(new Film("Test2")); assertThat(tablePresenter.createPseudoFilmList("Test"), is(expected)); assertThat(tablePresenter.createPseudoFilmList("Test"), is(not(notExpected))); }
@Test public void testFetchData() { // result from server is a list with at least one film -> give this film list to tableView when(filmDataModel.getAppliedFilter()).thenReturn(demoFilterWithResult); tablePresenter.fetchData(); // 1st called from constructor (no results info), 2nd called when rpc starts loading (loading // info),3rd the result from the rpc verify(tableView, times(3)).setTable(Matchers.anyListOf(Film.class)); // result from server is empty list -> tableView receives pseudo film list with information when(filmDataModel.getAppliedFilter()).thenReturn(demoFilterWithoutResult); tablePresenter.fetchData(); // 1st called from constructor (no results info), 2nd the result of the empty rpc verify(tableView, times(2)) .setTable(Matchers.eq(tablePresenter.createPseudoFilmList("No Search Results Found"))); }