TracingService extends RecordService { public List<Long> getAllOrderByDateDES() { return extractIds(tracingDao.getAllTracingsOrderByDate(false, PrimeroAppConfiguration.getCurrentUsername(), PrimeroAppConfiguration.getApiBaseUrl())); } TracingService(TracingDao tracingDao, TracingPhotoDao tracingPhotoDao); Tracing getById(long tracingId); Tracing getByUniqueId(String uniqueId); List<Tracing> getAll(); List<Long> getAllOrderByDateASC(); List<Long> getAllOrderByDateDES(); List<Long> getSearchResult(String uniqueId, String name, int ageFrom, int ageTo, Date
            date); Tracing saveOrUpdate(ItemValuesMap itemValues, List<String> photoPaths); Tracing save(ItemValuesMap itemValues, List<String> photoPaths); Tracing update(ItemValuesMap itemValues,
                          List<String> photoBitPaths); Tracing deleteByRecordId(long recordId); Tracing getByInternalId(String id); boolean hasSameRev(String id, String rev); List<Long> getAllSyncedRecordsId(); static final String TAG; static final String TRACING_DISPLAY_ID; static final String TRACING_ID; static final String TRACING_PRIMARY_ID; }
@Test public void should_return_all_order_ids_sorted_by_descending() throws Exception { Tracing[] orders = new Tracing[]{new Tracing(3), new Tracing(2), new Tracing(1)}; List<Tracing> orderList = Arrays.asList(orders); when(tracingDao.getAllTracingsOrderByDate(false, PrimeroAppConfiguration.getCurrentUsername(), TextUtils .lintUrl(url))) .thenReturn(orderList); assertThat("When call getAllOrderByDateDES() should return orders sorted by date.", tracingService.getAllOrderByDateDES(), is(Arrays.asList(new Long[]{3L, 2L, 1L}))); }