Exemple #1
0
  @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")));
  }
Exemple #2
0
  @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)));
  }
Exemple #3
0
 @Test
 public void testGo() {
   tablePresenter.go(container);
   verify(container).clear();
   verify(container).add(tableView.asWidget());
 }
Exemple #4
0
 @Test
 public void testUpdateTable() {
   List<Film> films = Arrays.asList(new Film("Test"));
   tablePresenter.updateTable(films);
   verify(tableView).setTable(films);
 }