IncidentService extends RecordService { public List<Long> getSearchResult(String uniqueId, String survivorCode, int ageFrom, int ageTo, String typeOfViolence, String location) { ConditionGroup searchCondition = getSearchCondition(uniqueId, survivorCode, ageFrom, ageTo, typeOfViolence, location); return extractIds(incidentDao.getIncidentListByConditionGroup(PrimeroAppConfiguration.getCurrentUsername(), PrimeroAppConfiguration.getApiBaseUrl(), searchCondition)); } IncidentService();  IncidentService(IncidentDao incidentDao); Incident getById(long incidentId); Incident getByUniqueId(String uniqueId); List<Incident> getAll(); List<Long> getAllOrderByDateASC(); List<Long> getAllOrderByDateDES(); List<Long> getAllOrderByAgeASC(); List<Long> getAllOrderByAgeDES(); List<Long> getSearchResult(String uniqueId, String survivorCode, int ageFrom, int ageTo, String
            typeOfViolence, String location); Incident saveOrUpdate(ItemValuesMap itemValues); Incident save(ItemValuesMap itemValues); Incident update(ItemValuesMap itemValues); Incident deleteByRecordId(long recordId); Incident getByInternalId(String id); boolean hasSameRev(String id, String rev); List<Long> getAllSyncedRecordsId(); static final String TAG; static final String INCIDENT_DISPLAY_ID; static final String INCIDENT_ID; static final String INCIDENT_PRIMARY_ID; static final String EMPTY_ID; }
@Test public void should_return_search_result_when_give_search_conditions() throws Exception { Incident[] orders = new Incident[]{new Incident(3), new Incident(2), new Incident(1)}; List<Incident> orderList = Arrays.asList(orders); when(incidentDao.getIncidentListByConditionGroup(anyString(), anyString(), any (ConditionGroup.class))).thenReturn (orderList); Assert.assertThat("When call getCPSearchResult() should return search result depends on " + "search " + "condition", incidentService.getSearchResult("uniqueId", "survivor_code", 1, 20, "type_of_violence ", "location"), is(Arrays.asList(new Long[]{3L, 2L, 1L}))); }