Merge branch '2.1.x'
Closes gh-17079
This commit is contained in:
@@ -33,8 +33,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Madhura Bhave
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = {
|
||||
"management.server.port=0", "spring.jersey.application-path=/app" })
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||
properties = { "management.server.port=0", "spring.jersey.application-path=/app" })
|
||||
class JerseyApplicationPathAndManagementPortTests {
|
||||
|
||||
@LocalServerPort
|
||||
@@ -48,9 +48,8 @@ class JerseyApplicationPathAndManagementPortTests {
|
||||
|
||||
@Test
|
||||
void applicationPathShouldNotAffectActuators() {
|
||||
ResponseEntity<String> entity = this.testRestTemplate.getForEntity(
|
||||
"http://localhost:" + this.managementPort + "/actuator/health",
|
||||
String.class);
|
||||
ResponseEntity<String> entity = this.testRestTemplate
|
||||
.getForEntity("http://localhost:" + this.managementPort + "/actuator/health", String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
assertThat(entity.getBody()).contains("\"status\":\"UP\"");
|
||||
}
|
||||
|
||||
@@ -35,30 +35,26 @@ class SampleJerseyApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
ResponseEntity<String> entity = this.restTemplate.getForEntity("/hello",
|
||||
String.class);
|
||||
ResponseEntity<String> entity = this.restTemplate.getForEntity("/hello", String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test
|
||||
void reverse() {
|
||||
ResponseEntity<String> entity = this.restTemplate
|
||||
.getForEntity("/reverse?input=olleh", String.class);
|
||||
ResponseEntity<String> entity = this.restTemplate.getForEntity("/reverse?input=olleh", String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
assertThat(entity.getBody()).isEqualTo("hello");
|
||||
}
|
||||
|
||||
@Test
|
||||
void validation() {
|
||||
ResponseEntity<String> entity = this.restTemplate.getForEntity("/reverse",
|
||||
String.class);
|
||||
ResponseEntity<String> entity = this.restTemplate.getForEntity("/reverse", String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
@Test
|
||||
void actuatorStatus() {
|
||||
ResponseEntity<String> entity = this.restTemplate.getForEntity("/actuator/health",
|
||||
String.class);
|
||||
ResponseEntity<String> entity = this.restTemplate.getForEntity("/actuator/health", String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
assertThat(entity.getBody()).isEqualTo("{\"status\":\"UP\"}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user