### Question:
HotelSummaryRepository { @SuppressWarnings("unchecked") public List<RatingCount> findRatingCounts(Hotel hotel) { Query query = entityManager.createQuery(FIND_RATING_COUNTS_QUERY); query.setParameter(1, hotel); return query.getResultList(); }  Page<HotelSummary> findByCity(City city, Pageable pageable); @SuppressWarnings("unchecked") List<RatingCount> findRatingCounts(Hotel hotel); @PersistenceContext void setEntityManager(EntityManager entityManager);  }### Answer:
@Test public void shouldFindRatingCounts() throws Exception { List<RatingCount> ratingCounts = this.hotelSummaryRepository.findRatingCounts(this.bathPriory); assertThat(ratingCounts.get(0).getRating(), is(Rating.EXCELLENT)); assertThat(ratingCounts.get(0).getCount(), is(11L)); assertThat(ratingCounts.get(1).getRating(), is(Rating.GOOD)); assertThat(ratingCounts.get(1).getCount(), is(6L)); assertThat(ratingCounts.get(2).getRating(), is(Rating.AVERAGE)); assertThat(ratingCounts.get(2).getCount(), is(3L)); assertThat(ratingCounts.get(3).getRating(), is(Rating.POOR)); assertThat(ratingCounts.get(3).getCount(), is(1L)); assertThat(ratingCounts.get(4).getRating(), is(Rating.TERRIBLE)); assertThat(ratingCounts.get(4).getCount(), is(1L)); }