コード例 #1
0
 @Test
 public void onViewCreated_shouldPopulateAdapter() {
   Clubs clubs = ModelBuilder.getClubs(4, "Club Name");
   mockRestService.addResponse(clubs, true);
   SupportFragmentTestUtil.startFragment(fragment);
   assertThat(fragment.adapter.getItemCount()).isEqualTo(4);
 }
コード例 #2
0
  @Test
  public void pullToRefresh_refetchesClubs() {
    SupportFragmentTestUtil.startFragment(fragment);
    assertThat(fragment.adapter.getItemCount()).isEqualTo(0);

    Clubs clubs = ModelBuilder.getClubs(4, "Club Name");
    mockRestService.addResponse(clubs, true);
    fragment.onRefresh();

    assertThat(fragment.adapter.getItemCount()).isEqualTo(4);
  }