Merge branch '2.0.x' into 2.1.x
Closes gh-17078
This commit is contained in:
@@ -36,8 +36,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Madhura Bhave
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@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" })
|
||||
public class JerseyApplicationPathAndManagementPortTests {
|
||||
|
||||
@LocalServerPort
|
||||
@@ -51,9 +51,8 @@ public class JerseyApplicationPathAndManagementPortTests {
|
||||
|
||||
@Test
|
||||
public 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\"");
|
||||
}
|
||||
|
||||
@@ -38,30 +38,26 @@ public class SampleJerseyApplicationTests {
|
||||
|
||||
@Test
|
||||
public 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
|
||||
public 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
|
||||
public 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
|
||||
public 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