IncidentListPresenter extends RecordListPresenter { @Override public List<Long> getRecordsByFilter(SpinnerState spinnerState) { switch (spinnerState) { case AGE_ASC: return incidentService.getAllOrderByAgeASC(); case AGE_DES: return incidentService.getAllOrderByAgeDES(); case INTERVIEW_DATE_ASC: return incidentService.getAllOrderByDateASC(); case INTERVIEW_DATE_DES: return incidentService.getAllOrderByDateDES(); default: return new ArrayList<>(); } } @Inject  IncidentListPresenter(IncidentService incidentService, IncidentFormService
            incidentFormService, RecordService recordService); @Override boolean isFormReady(); @Override List<Long> getRecordsByFilter(SpinnerState spinnerState); @Override List<Long> getSyncedRecords(); @Override int getSyncedRecordsCount(); @Override int calculateDisplayedIndex();  }
@Test public void should_return_records_by_age_ASC_filter(){ SpinnerState spinnerState = SpinnerState.AGE_ASC; List<Long> expected = new ArrayList<>(); when(incidentService.getAllOrderByAgeASC()).thenReturn(expected); List<Long> actual = incidentListPresenter.getRecordsByFilter(spinnerState); assertThat("Should return records by age ASC filter when SpinnerState is AGE_ASC", actual, is(expected)); }
@Test public void should_return_records_by_age_DES_filter() throws Exception { SpinnerState spinnerState = SpinnerState.AGE_DES; List<Long> expected = new ArrayList<>(); when(incidentService.getAllOrderByAgeDES()).thenReturn(expected); List<Long> actual = incidentListPresenter.getRecordsByFilter(spinnerState); assertThat("Should return records by age DES 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.INTERVIEW_DATE_DES; List<Long> expected = new ArrayList<>(); when(incidentService.getAllOrderByDateDES()).thenReturn(expected); List<Long> actual = incidentListPresenter.getRecordsByFilter(spinnerState); assertThat("Should return records by registrarion date DES filter when SpinnerState is AGE_DES", actual, is(expected)); }
@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(incidentService.getAllOrderByDateASC()).thenReturn(expected); List<Long> actual = incidentListPresenter.getRecordsByFilter(spinnerState); assertThat("Should return records by registrarion date ASC filter when SpinnerState is AGE_DES", actual, is(expected)); }