### Question:
WishlistSerieRepository extends CrudRepository<WishlistSerieDao, WishlistSerie> { public WishlistSerie findByTmdbId(long tmdbId) { Query<WishlistSerie> wishlistSerieQuery = dao.queryBuilder() .where(WishlistSerieDao.Properties.Tmdb_id.eq(tmdbId)) .limit(1) .build(); List<WishlistSerie> wishlistSeries = wishlistSerieQuery.list(); return wishlistSeries != null && wishlistSeries.size() > 0 ? wishlistSeries.get(0) : null; } WishlistSerieRepository(DaoSession daoSession); WishlistSerie findByTmdbId(long tmdbId);  }### Answer:
@Test public void findBySerieId() { QueryBuilder queryBuilder = mock(QueryBuilder.class); doReturn(queryBuilder).when(wishlistSerieDao).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(wishlistSerie)).when(query).list(); assertEquals( wishlistSerie, new WishlistSerieRepository(daoSession).findByTmdbId(45) ); }