Polish
This commit is contained in:
@@ -54,7 +54,7 @@ public class CorsSampleActuatorApplicationTests {
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
LocalHostUriTemplateHandler handler = new LocalHostUriTemplateHandler(
|
||||
this.applicationContext.getEnvironment(), "http");
|
||||
@@ -64,7 +64,7 @@ public class CorsSampleActuatorApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void endpointShouldReturnUnauthorized() throws Exception {
|
||||
public void endpointShouldReturnUnauthorized() {
|
||||
ResponseEntity<?> entity = this.testRestTemplate.getForEntity("/actuator/env",
|
||||
Map.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED);
|
||||
|
||||
@@ -48,7 +48,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests {
|
||||
private int managementPort = 9011;
|
||||
|
||||
@Test
|
||||
public void testHome() throws Exception {
|
||||
public void testHome() {
|
||||
ResponseEntity<String> entity = new TestRestTemplate("user", "password")
|
||||
.getForEntity("http://localhost:" + this.port, String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
@@ -56,7 +56,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSecureActuator() throws Exception {
|
||||
public void testSecureActuator() {
|
||||
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(
|
||||
"http://localhost:" + this.managementPort + "/management/actuator/env",
|
||||
String.class);
|
||||
@@ -64,7 +64,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInsecureActuator() throws Exception {
|
||||
public void testInsecureActuator() {
|
||||
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(
|
||||
"http://localhost:" + this.managementPort + "/management/actuator/health",
|
||||
String.class);
|
||||
@@ -73,7 +73,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMissing() throws Exception {
|
||||
public void testMissing() {
|
||||
ResponseEntity<String> entity = new TestRestTemplate("admin", "admin")
|
||||
.getForEntity("http://localhost:" + this.managementPort
|
||||
+ "/management/actuator/missing", String.class);
|
||||
|
||||
@@ -41,7 +41,7 @@ public class SampleActuatorCustomSecurityApplicationTests {
|
||||
private TestRestTemplate restTemplate;
|
||||
|
||||
@Test
|
||||
public void homeIsSecure() throws Exception {
|
||||
public void homeIsSecure() {
|
||||
@SuppressWarnings("rawtypes")
|
||||
ResponseEntity<Map> entity = this.restTemplate.getForEntity("/", Map.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED);
|
||||
@@ -52,7 +52,7 @@ public class SampleActuatorCustomSecurityApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInsecureApplicationPath() throws Exception {
|
||||
public void testInsecureApplicationPath() {
|
||||
@SuppressWarnings("rawtypes")
|
||||
ResponseEntity<Map> entity = this.restTemplate.getForEntity("/foo", Map.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
@@ -63,7 +63,7 @@ public class SampleActuatorCustomSecurityApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInsecureStaticResources() throws Exception {
|
||||
public void testInsecureStaticResources() {
|
||||
ResponseEntity<String> entity = this.restTemplate
|
||||
.getForEntity("/css/bootstrap.min.css", String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
@@ -71,7 +71,7 @@ public class SampleActuatorCustomSecurityApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void insecureActuator() throws Exception {
|
||||
public void insecureActuator() {
|
||||
ResponseEntity<String> entity = this.restTemplate.getForEntity("/actuator/health",
|
||||
String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
@@ -79,7 +79,7 @@ public class SampleActuatorCustomSecurityApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void secureActuator() throws Exception {
|
||||
public void secureActuator() {
|
||||
@SuppressWarnings("rawtypes")
|
||||
ResponseEntity<Map> entity = this.restTemplate.getForEntity("/actuator/env",
|
||||
Map.class);
|
||||
|
||||
Reference in New Issue
Block a user