### Question:
LocalKinoRepository extends CrudRepository<LocalKinoDao, LocalKino> { public List<LocalKino> findAllByReviewDate(boolean asc) { return queryOrderBy(asc, LocalKinoDao.Properties.Review_date); } LocalKinoRepository(DaoSession daoSession); LocalKino findByMovieId(long movieId); List<LocalKino> findAllByRating(boolean asc); List<LocalKino> findAllByYear(boolean asc); List<LocalKino> findAllByReviewDate(boolean asc); List<LocalKino> findAllByTitle(final boolean asc);  }### Answer:
@Test public void findAllByReviewDateAsc() { QueryBuilder queryBuilder = mock(QueryBuilder.class); doReturn(queryBuilder).when(localKinoDao).queryBuilder(); doReturn(queryBuilder).when(queryBuilder).orderAsc(LocalKinoDao.Properties.Review_date); Query query = mock(Query.class); doReturn(query).when(queryBuilder).build(); doReturn(Collections.singletonList(localKino)).when(query).list(); assertEquals( Collections.singletonList(localKino), new LocalKinoRepository(daoSession).findAllByReviewDate(true) ); }
@Test public void findAllByReviewDateDesc() { QueryBuilder queryBuilder = mock(QueryBuilder.class); doReturn(queryBuilder).when(localKinoDao).queryBuilder(); doReturn(queryBuilder).when(queryBuilder).orderDesc(LocalKinoDao.Properties.Review_date); Query query = mock(Query.class); doReturn(query).when(queryBuilder).build(); doReturn(Collections.singletonList(localKino)).when(query).list(); assertEquals( Collections.singletonList(localKino), new LocalKinoRepository(daoSession).findAllByReviewDate(false) ); }