Polish
This commit is contained in:
parent
febf30ef0a
commit
d1cf308bd2
|
@ -68,7 +68,7 @@ public class ConfigurationPropertiesReportEndpointAutoConfigurationTests {
|
|||
|
||||
private ContextConsumer<AssertableApplicationContext> validateTestProperties(
|
||||
String dbPassword, String myTestProperty) {
|
||||
return context -> {
|
||||
return (context) -> {
|
||||
assertThat(context)
|
||||
.hasSingleBean(ConfigurationPropertiesReportEndpoint.class);
|
||||
ConfigurationPropertiesReportEndpoint endpoint = context
|
||||
|
|
|
@ -65,7 +65,7 @@ public class EnvironmentEndpointAutoConfigurationTests {
|
|||
|
||||
private ContextConsumer<AssertableApplicationContext> validateSystemProperties(
|
||||
String dbPassword, String apiKey) {
|
||||
return context -> {
|
||||
return (context) -> {
|
||||
assertThat(context).hasSingleBean(EnvironmentEndpoint.class);
|
||||
EnvironmentEndpoint endpoint = context.getBean(EnvironmentEndpoint.class);
|
||||
EnvironmentDescriptor env = endpoint.environment(null);
|
||||
|
|
|
@ -543,77 +543,72 @@ public class RabbitAutoConfigurationTests {
|
|||
@Test
|
||||
// Make sure that we at least attempt to load the store
|
||||
public void enableSslWithNonExistingKeystoreShouldFail() {
|
||||
this.contextRunner
|
||||
.withUserConfiguration(TestConfiguration.class)
|
||||
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
||||
.withPropertyValues("spring.rabbitmq.ssl.enabled:true",
|
||||
"spring.rabbitmq.ssl.keyStore=foo",
|
||||
"spring.rabbitmq.ssl.keyStorePassword=secret")
|
||||
.run(context -> {
|
||||
.run((context) -> {
|
||||
assertThat(context).hasFailed();
|
||||
assertThat(context).getFailure().hasMessageContaining("foo");
|
||||
assertThat(context).getFailure().hasMessageContaining("does not exist");
|
||||
assertThat(context).getFailure()
|
||||
.hasMessageContaining("does not exist");
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
// Make sure that we at least attempt to load the store
|
||||
public void enableSslWithNonExistingTrustStoreShouldFail() {
|
||||
this.contextRunner
|
||||
.withUserConfiguration(TestConfiguration.class)
|
||||
.withPropertyValues(
|
||||
"spring.rabbitmq.ssl.enabled:true",
|
||||
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
||||
.withPropertyValues("spring.rabbitmq.ssl.enabled:true",
|
||||
"spring.rabbitmq.ssl.trustStore=bar",
|
||||
"spring.rabbitmq.ssl.trustStorePassword=secret")
|
||||
.run((context) -> {
|
||||
assertThat(context).hasFailed();
|
||||
assertThat(context).getFailure().hasMessageContaining("bar");
|
||||
assertThat(context).getFailure().hasMessageContaining("does not exist");
|
||||
assertThat(context).getFailure()
|
||||
.hasMessageContaining("does not exist");
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void enableSslWithInvalidKeystoreTypeShouldFail() throws Exception {
|
||||
this.contextRunner
|
||||
.withUserConfiguration(TestConfiguration.class)
|
||||
.withPropertyValues(
|
||||
"spring.rabbitmq.ssl.enabled:true",
|
||||
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
||||
.withPropertyValues("spring.rabbitmq.ssl.enabled:true",
|
||||
"spring.rabbitmq.ssl.keyStore=foo",
|
||||
"spring.rabbitmq.ssl.keyStoreType=fooType")
|
||||
.run(context -> {
|
||||
.run((context) -> {
|
||||
assertThat(context).hasFailed();
|
||||
assertThat(context).getFailure().hasMessageContaining("fooType");
|
||||
assertThat(context).getFailure().hasRootCauseInstanceOf(NoSuchAlgorithmException.class);
|
||||
assertThat(context).getFailure()
|
||||
.hasRootCauseInstanceOf(NoSuchAlgorithmException.class);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void enableSslWithInvalidTrustStoreTypeShouldFail() throws Exception {
|
||||
this.contextRunner
|
||||
.withUserConfiguration(TestConfiguration.class)
|
||||
.withPropertyValues(
|
||||
"spring.rabbitmq.ssl.enabled:true",
|
||||
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
||||
.withPropertyValues("spring.rabbitmq.ssl.enabled:true",
|
||||
"spring.rabbitmq.ssl.trustStore=bar",
|
||||
"spring.rabbitmq.ssl.trustStoreType=barType")
|
||||
.run(context -> {
|
||||
.run((context) -> {
|
||||
assertThat(context).hasFailed();
|
||||
assertThat(context).getFailure().hasMessageContaining("barType");
|
||||
assertThat(context).getFailure().hasRootCauseInstanceOf(NoSuchAlgorithmException.class);
|
||||
assertThat(context).getFailure()
|
||||
.hasRootCauseInstanceOf(NoSuchAlgorithmException.class);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void enableSslWithKeystoreTypeAndTrustStoreTypeShouldWork() throws Exception {
|
||||
this.contextRunner
|
||||
.withUserConfiguration(TestConfiguration.class)
|
||||
.withPropertyValues(
|
||||
"spring.rabbitmq.ssl.enabled:true",
|
||||
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
||||
.withPropertyValues("spring.rabbitmq.ssl.enabled:true",
|
||||
"spring.rabbitmq.ssl.keyStore=/org/springframework/boot/autoconfigure/amqp/test.jks",
|
||||
"spring.rabbitmq.ssl.keyStoreType=jks",
|
||||
"spring.rabbitmq.ssl.keyStorePassword=secret",
|
||||
"spring.rabbitmq.ssl.trustStore=/org/springframework/boot/autoconfigure/amqp/test.jks",
|
||||
"spring.rabbitmq.ssl.trustStoreType=jks",
|
||||
"spring.rabbitmq.ssl.trustStorePassword=secret")
|
||||
.run(context -> assertThat(context).hasNotFailed());
|
||||
.run((context) -> assertThat(context).hasNotFailed());
|
||||
}
|
||||
|
||||
private com.rabbitmq.client.ConnectionFactory getTargetConnectionFactory(
|
||||
|
|
|
@ -70,7 +70,8 @@ public class EndpointMappingTests {
|
|||
|
||||
@Test
|
||||
public void subPathWithoutALeadingSlashIsSeparatedFromBasePathBySingleSlash() {
|
||||
assertThat(new EndpointMapping("/test").createSubPath("one")).isEqualTo("/test/one");
|
||||
assertThat(new EndpointMapping("/test").createSubPath("one"))
|
||||
.isEqualTo("/test/one");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue