Show better message for missing config keystore props (#232)
* Show better message for missing config keystore props * Removes unused ExpectedException Fixes #230
This commit is contained in:
committed by
Spencer Gibb
parent
54d55010de
commit
a6b7f70b8e
@@ -1,12 +1,13 @@
|
||||
package org.springframework.cloud.bootstrap.encrypt;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.security.crypto.encrypt.TextEncryptor;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class EncryptionBootstrapConfigurationTests {
|
||||
|
||||
@Test
|
||||
@@ -35,4 +36,23 @@ public class EncryptionBootstrapConfigurationTests {
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nonExistentKeystoreLocationShouldNotBeAllowed() {
|
||||
try {
|
||||
new SpringApplicationBuilder(EncryptionBootstrapConfiguration.class)
|
||||
.web(false)
|
||||
.properties("encrypt.key-store.location:classpath:/server.jks1",
|
||||
"encrypt.key-store.password:letmein",
|
||||
"encrypt.key-store.alias:mytestkey",
|
||||
"encrypt.key-store.secret:changeme")
|
||||
.run();
|
||||
assertThat(false)
|
||||
.as("Should not create an application context with invalid keystore location")
|
||||
.isTrue();
|
||||
}
|
||||
catch (Exception e) {
|
||||
assertThat(e).hasRootCauseInstanceOf(IllegalStateException.class);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user