TracingListPresenter extends RecordListPresenter { @Override public List<Long> getRecordsByFilter(SpinnerState spinnerState) { switch (spinnerState) { case INQUIRY_DATE_ASC: return tracingService.getAllOrderByDateASC(); case INQUIRY_DATE_DES: return tracingService.getAllOrderByDateDES(); default: return null; } } @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_records_by_registration_date_ASC_filter() throws Exception { SpinnerState spinnerState = SpinnerState.INQUIRY_DATE_ASC; List<Long> expected = new ArrayList<>(); when(tracingService.getAllOrderByDateASC()).thenReturn(expected); List<Long> actual = tracingListPresenter.getRecordsByFilter(spinnerState); assertThat("Should return records by registrarion date ASC filter when SpinnerState is " + "AGE_DES", actual, is(expected)); }
@Test public void should_return_records_by_registration_date_DES_filter() throws Exception { SpinnerState spinnerState = SpinnerState.INQUIRY_DATE_DES; List<Long> expected = new ArrayList<>(); when(tracingService.getAllOrderByDateDES()).thenReturn(expected); List<Long> actual = tracingListPresenter.getRecordsByFilter(spinnerState); assertThat("Should return records by registrarion date DES filter when SpinnerState is " + "AGE_DES", actual, is(expected)); }