### Question:
SerieReviewRepository extends CrudRepository<SerieReviewDao, SerieReview> { public SerieReview findByMovieId(long movieId) { Query<SerieReview> serieReviewQuery = dao.queryBuilder() .where(SerieReviewDao.Properties.Tmdb_id.eq(movieId)) .limit(1) .build(); List<SerieReview> serieReviews = serieReviewQuery.list(); return serieReviews != null && serieReviews.size() > 0 ? serieReviews.get(0) : null; } SerieReviewRepository(DaoSession daoSession); SerieReview findByMovieId(long movieId); List<SerieReview> findAllByRating(boolean asc); List<SerieReview> findAllByTitle(boolean asc);  }### Answer:
@Test public void findByMovieId() { QueryBuilder queryBuilder = mock(QueryBuilder.class); doReturn(queryBuilder).when(serieReviewDao).queryBuilder(); doReturn(queryBuilder).when(queryBuilder).where(any(WhereCondition.class)); doReturn(queryBuilder).when(queryBuilder).limit(1); Query query = mock(Query.class); doReturn(query).when(queryBuilder).build(); doReturn(Collections.singletonList(serieReview)).when(query).list(); assertEquals( serieReview, new SerieReviewRepository(daoSession).findByMovieId(45) ); }