From d1cf308bd2367a790082d8d3cb87b0030f2843bc Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 18 Sep 2017 19:23:26 +0100 Subject: [PATCH] Polish --- ...sReportEndpointAutoConfigurationTests.java | 2 +- ...ronmentEndpointAutoConfigurationTests.java | 2 +- .../amqp/RabbitAutoConfigurationTests.java | 47 +++++++++---------- .../endpoint/web/EndpointMappingTests.java | 3 +- 4 files changed, 25 insertions(+), 29 deletions(-) diff --git a/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/context/properties/ConfigurationPropertiesReportEndpointAutoConfigurationTests.java b/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/context/properties/ConfigurationPropertiesReportEndpointAutoConfigurationTests.java index e1443a6f89..c7e3701171 100644 --- a/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/context/properties/ConfigurationPropertiesReportEndpointAutoConfigurationTests.java +++ b/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/context/properties/ConfigurationPropertiesReportEndpointAutoConfigurationTests.java @@ -68,7 +68,7 @@ public class ConfigurationPropertiesReportEndpointAutoConfigurationTests { private ContextConsumer validateTestProperties( String dbPassword, String myTestProperty) { - return context -> { + return (context) -> { assertThat(context) .hasSingleBean(ConfigurationPropertiesReportEndpoint.class); ConfigurationPropertiesReportEndpoint endpoint = context diff --git a/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/env/EnvironmentEndpointAutoConfigurationTests.java b/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/env/EnvironmentEndpointAutoConfigurationTests.java index d926c87034..d5d676730b 100644 --- a/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/env/EnvironmentEndpointAutoConfigurationTests.java +++ b/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/env/EnvironmentEndpointAutoConfigurationTests.java @@ -65,7 +65,7 @@ public class EnvironmentEndpointAutoConfigurationTests { private ContextConsumer 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); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java index 4e116b6025..7dc54b3bf8 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java @@ -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( diff --git a/spring-boot/src/test/java/org/springframework/boot/endpoint/web/EndpointMappingTests.java b/spring-boot/src/test/java/org/springframework/boot/endpoint/web/EndpointMappingTests.java index a78e942d82..f235fa3ad7 100644 --- a/spring-boot/src/test/java/org/springframework/boot/endpoint/web/EndpointMappingTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/endpoint/web/EndpointMappingTests.java @@ -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