Merge branch '1.2.x'
This commit is contained in:
@@ -39,10 +39,10 @@ public class HotelSummary implements Serializable {
|
||||
public HotelSummary(City city, String name, Double averageRating) {
|
||||
this.city = city;
|
||||
this.name = name;
|
||||
this.averageRating = averageRating == null ? null : new BigDecimal(averageRating,
|
||||
MATH_CONTEXT).doubleValue();
|
||||
this.averageRatingRounded = averageRating == null ? null : (int) Math
|
||||
.round(averageRating);
|
||||
this.averageRating = averageRating == null ? null
|
||||
: new BigDecimal(averageRating, MATH_CONTEXT).doubleValue();
|
||||
this.averageRatingRounded = averageRating == null ? null
|
||||
: (int) Math.round(averageRating);
|
||||
}
|
||||
|
||||
public City getCity() {
|
||||
|
||||
@@ -36,7 +36,8 @@ class CityServiceImpl implements CityService {
|
||||
private final HotelRepository hotelRepository;
|
||||
|
||||
@Autowired
|
||||
public CityServiceImpl(CityRepository cityRepository, HotelRepository hotelRepository) {
|
||||
public CityServiceImpl(CityRepository cityRepository,
|
||||
HotelRepository hotelRepository) {
|
||||
this.cityRepository = cityRepository;
|
||||
this.hotelRepository = hotelRepository;
|
||||
}
|
||||
|
||||
@@ -73,12 +73,9 @@ public class SampleDataJpaApplicationTests {
|
||||
|
||||
@Test
|
||||
public void testJmx() throws Exception {
|
||||
assertEquals(
|
||||
1,
|
||||
ManagementFactory
|
||||
.getPlatformMBeanServer()
|
||||
.queryMBeans(new ObjectName("jpa.sample:type=ConnectionPool,*"),
|
||||
null).size());
|
||||
assertEquals(1, ManagementFactory.getPlatformMBeanServer()
|
||||
.queryMBeans(new ObjectName("jpa.sample:type=ConnectionPool,*"), null)
|
||||
.size());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -59,10 +59,10 @@ public class HotelRepositoryIntegrationTests {
|
||||
.get(0);
|
||||
assertThat(city.getName(), is("Atlanta"));
|
||||
|
||||
Page<HotelSummary> hotels = this.repository.findByCity(city, new PageRequest(0,
|
||||
10, Direction.ASC, "name"));
|
||||
Hotel hotel = this.repository.findByCityAndName(city, hotels.getContent().get(0)
|
||||
.getName());
|
||||
Page<HotelSummary> hotels = this.repository.findByCity(city,
|
||||
new PageRequest(0, 10, Direction.ASC, "name"));
|
||||
Hotel hotel = this.repository.findByCityAndName(city,
|
||||
hotels.getContent().get(0).getName());
|
||||
assertThat(hotel.getName(), is("Doubletree"));
|
||||
|
||||
List<RatingCount> counts = this.repository.findRatingCounts(hotel);
|
||||
|
||||
Reference in New Issue
Block a user