CasePhotoService { public CasePhoto getById(long id) { return casePhotoDao.getById(id); } CasePhotoService(CasePhotoDao caseDao); static CasePhotoService getInstance(); CasePhoto getFirst(long caseId); CasePhoto getById(long id); List<Long> getIdsByCaseId(long caseId); boolean hasUnSynced(long caseId); void deleteByCaseId(long caseId); static final String TAG; }
@Test public void should_call_get_by_id_of_case_photo_dao() throws Exception { CasePhoto casePhoto = new CasePhoto(); when(casePhotoDao.getById(anyLong())).thenReturn(casePhoto); assertThat("Should return CasePhoto", casePhotoService.getById(123L), is(casePhoto)); verify(casePhotoDao, times(1)).getById(123L); }