TracingListPresenter extends RecordListPresenter { @Override public int calculateDisplayedIndex() { List<Tracing> tracings = tracingService.getAll(); return tracings.isEmpty() ? HAVE_NO_RESULT : RecordListFragment.HAVE_RESULT_LIST; } @Inject  TracingListPresenter(TracingService tracingService, TracingFormService tracingFormService, RecordService recordService); @Override boolean isFormReady(); @Override int calculateDisplayedIndex(); @Override List<Long> getRecordsByFilter(SpinnerState spinnerState); @Override List<Long> getSyncedRecords(); @Override int getSyncedRecordsCount();  }
@Test public void should_return_displayed_index() throws Exception { when(tracingService.getAll()).thenReturn(Collections.EMPTY_LIST); int index = tracingListPresenter.calculateDisplayedIndex(); assertThat("Should return 0 when tracing_request is empty", index, is(1)); }