### Question:
ViewAllEnquiryScroller extends Scroller { @Override public void loadRecordsForNextPage() throws JSONException { if(shouldQueryForMoreData()){ adapter.addAll(repository.getRecordsBetween(adapter.getCount(), adapter.getCount() + DEFAULT_PAGE_SIZE)); } } ViewAllEnquiryScroller(EnquiryRepository repository, HighlightedFieldsViewAdapter<Enquiry> adapter); @Override void loadRecordsForNextPage();  }### Answer:
@Test public void shouldLoadRecordsForNextPage() throws JSONException { List<Enquiry> enquiries = Arrays.asList(new Enquiry("{\"name\": \"Foo Bar\"}")); when(repository.getRecordsBetween(anyInt(), anyInt())).thenReturn(enquiries); doReturn(true).when(scroller).shouldQueryForMoreData(); scroller.loadRecordsForNextPage(); verify(repository, atLeastOnce()).getRecordsBetween(anyInt(), anyInt()); verify(highlightedFieldsViewAdapter, atLeastOnce()).addAll(enquiries); }
@Test public void shouldNotLoadRecordsForNextPage() throws JSONException { doReturn(false).when(scroller).shouldQueryForMoreData(); scroller.loadRecordsForNextPage(); verify(repository, times(0)).getRecordsBetween(anyInt(), anyInt()); verify(highlightedFieldsViewAdapter, times(0)).addAll(anyList()); }