properties = { //
"server.ssl.key-store=./config/r-app-catalogue-keystore.jks", //
"server.http-port=0"})
-public class HttpsRequestTest {
+class HttpsRequestTest {
@Value("${server.ssl.key-store-password}")
private String keyStorePassword; // inject password from config
private AbstractConfigurableWebServerFactory webServerFactory;
@Test
- public void testSsl() {
+ void testSsl() {
assertEquals(true, this.webServerFactory.getSsl().isEnabled());
}
@Test
- public void rest_OverPlainHttp_GetsBadRequestRequiresTLS() throws Exception {
+ void rest_OverPlainHttp_GetsBadRequestRequiresTLS() throws Exception {
TestRestTemplate template = new TestRestTemplate();
ResponseEntity<String> responseEntity =
template.getForEntity("http://localhost:" + port + "/services", String.class);
}
@Test
- public void rest_WithoutSSLConfiguration_ThrowsSSLExceptionUnableFindValidCertPath() throws Exception {
+ void rest_WithoutSSLConfiguration_ThrowsSSLExceptionUnableFindValidCertPath() throws Exception {
TestRestTemplate template = new TestRestTemplate();
ResourceAccessException thrown = assertThrows(ResourceAccessException.class, () -> {
}
@Test
- public void rest_WithTwoWaySSL_AuthenticatesAndGetsExpectedResponse() throws Exception {
+ void rest_WithTwoWaySSL_AuthenticatesAndGetsExpectedResponse() throws Exception {
SSLContext sslContext = new SSLContextBuilder().loadKeyMaterial(ResourceUtils.getFile(keyStore),
keyStorePassword.toCharArray(), keyStorePassword.toCharArray()).build();