This commit is contained in:
Phillip Webb
2018-02-22 20:25:10 -08:00
parent 80ac4f85c9
commit cd5266ac03
28 changed files with 71 additions and 70 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,8 +41,8 @@ public class CityRepositoryIntegrationTests {
@Test
public void findsFirstPageOfCities() {
Page<City> cities = this.repository.findAll(PageRequest.of(0, 10));
assertThat(cities.getTotalElements()).isGreaterThan(20L);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,6 +45,7 @@ public class HotelRepositoryIntegrationTests {
@Autowired
CityRepository cityRepository;
@Autowired
HotelRepository repository;
@@ -53,16 +54,15 @@ public class HotelRepositoryIntegrationTests {
City city = this.cityRepository
.findAll(PageRequest.of(0, 1, Direction.ASC, "name")).getContent().get(0);
assertThat(city.getName()).isEqualTo("Atlanta");
Page<HotelSummary> hotels = this.repository.findByCity(city,
PageRequest.of(0, 10, Direction.ASC, "name"));
Hotel hotel = this.repository.findByCityAndName(city,
hotels.getContent().get(0).getName());
assertThat(hotel.getName()).isEqualTo("Doubletree");
List<RatingCount> counts = this.repository.findRatingCounts(hotel);
assertThat(counts).hasSize(1);
assertThat(counts.get(0).getRating()).isEqualTo(Rating.AVERAGE);
assertThat(counts.get(0).getCount()).isGreaterThan(1L);
}
}