@Before public void setup() { fragment = ClubsFragment.newInstance(); ((TestApplicationComponent) RacquetApplication.getApplication().getApplicationComponent()) .inject(this); RacquetApplication.getApplication().getApplicationComponent().inject(fragment); mockRestService = (MockRacquetRestService) restService; }
@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); }