Merge branch '2.0.x' into 2.1.x
Closes gh-17078
This commit is contained in:
@@ -45,8 +45,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
// Enable JMX so we can test the MBeans (you can't do this in a properties file)
|
||||
@SpringBootTest(
|
||||
properties = { "spring.jmx.enabled:true", "spring.datasource.jmx-enabled:true" })
|
||||
@SpringBootTest(properties = { "spring.jmx.enabled:true", "spring.datasource.jmx-enabled:true" })
|
||||
@ActiveProfiles("scratch")
|
||||
// Separate profile for web tests to avoid clashing databases
|
||||
public class SampleDataJpaApplicationTests {
|
||||
@@ -64,15 +63,13 @@ public class SampleDataJpaApplicationTests {
|
||||
@Test
|
||||
public void testHome() throws Exception {
|
||||
|
||||
this.mvc.perform(get("/")).andExpect(status().isOk())
|
||||
.andExpect(content().string("Bath"));
|
||||
this.mvc.perform(get("/")).andExpect(status().isOk()).andExpect(content().string("Bath"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJmx() throws Exception {
|
||||
assertThat(ManagementFactory.getPlatformMBeanServer()
|
||||
.queryMBeans(new ObjectName("jpa.sample:type=HikariDataSource,*"), null))
|
||||
.hasSize(1);
|
||||
.queryMBeans(new ObjectName("jpa.sample:type=HikariDataSource,*"), null)).hasSize(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -51,13 +51,10 @@ public class HotelRepositoryIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void executesQueryMethodsCorrectly() {
|
||||
City city = this.cityRepository
|
||||
.findAll(PageRequest.of(0, 1, Direction.ASC, "name")).getContent().get(0);
|
||||
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());
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user