TracingPhotoService { public boolean hasUnSynced(long tracingId) { return tracingPhotoDao.countUnSynced(tracingId) > 0; } TracingPhotoService(TracingPhotoDao tracingDao); static TracingPhotoService getInstance(); TracingPhoto getFirst(long tracingId); TracingPhoto getById(long id); List<Long> getIdsByTracingId(long tracingId); boolean hasUnSynced(long tracingId); void deleteByTracingId(long tracingId); static final String TAG; }
@Test public void should_call_count_un_synced_by_tracing_photo_dao() throws Exception { when(tracingPhotoDao.countUnSynced(anyLong())).thenReturn(1L); boolean actual = tracingPhotoService.hasUnSynced(123L); verify(tracingPhotoDao, times(1)).countUnSynced(123L); assertTrue("When hasUnSynced() is more than zero, should return true", actual); }