IncidentSearchPresenter extends RecordSearchPresenter { @Override protected List<Long> getSearchResult(Map<String, String> searchConditions) { String id = searchConditions.get(ID); String survivorCode = searchConditions.get(SURVIVOR_CODE); int ageFrom = Integer.valueOf(searchConditions.get(AGE_FROM)); int ageTo = Integer.valueOf(searchConditions.get(AGE_TO)); String typeOfViolence = searchConditions.get(TYPE_OF_VIOLENCE); String location = searchConditions.get(LOCATION); return incidentService.getSearchResult(id, survivorCode, ageFrom, ageTo, typeOfViolence, location); } @Inject  IncidentSearchPresenter(IncidentService incidentService, IncidentFormService incidentFormService); List<String> getViolenceTypeList(); List<String> getIncidentLocationList();  }
@Test public void should_get_incident_list_when_search_result() throws Exception { Map<String, String> searchConditions = mock(Map.class); List<Long> list = new ArrayList<>(); when(searchConditions.get(anyString())).thenReturn("0"); when(incidentService.getSearchResult(anyString(),anyString(),anyInt(),anyInt(),anyString(),anyString())) .thenReturn(list); assertThat("Should return same list", incidentSearchPresenter.getSearchResult(searchConditions), is(list)); }