From 2fe86da95bd348c58522d3d9263aa35dc19bcc60 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Thu, 22 Feb 2018 16:20:24 +0900 Subject: [PATCH] Use isTrue() and isFalse() for AssertJ Closes gh-12170 --- .../web/server/ManagementServerPropertiesTests.java | 2 +- .../template/GroovyTemplateAutoConfigurationTests.java | 2 +- .../jdbc/DataSourceAutoConfigurationTests.java | 2 +- .../jms/activemq/ActiveMQAutoConfigurationTests.java | 10 +++++----- .../jms/activemq/ActiveMQPropertiesTests.java | 4 ++-- .../boot/autoconfigure/web/ServerPropertiesTests.java | 4 ++-- .../TomcatServletWebServerFactoryCustomizerTests.java | 2 +- .../LocalDevToolsAutoConfigurationTests.java | 2 +- .../boot/test/mock/mockito/DefinitionsParserTests.java | 2 +- .../DelegatingFilterProxyRegistrationBeanTests.java | 2 +- .../server/AbstractServletWebServerFactoryTests.java | 2 +- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementServerPropertiesTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementServerPropertiesTests.java index bef1554c68..608d68f9e9 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementServerPropertiesTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementServerPropertiesTests.java @@ -33,7 +33,7 @@ public class ManagementServerPropertiesTests { ManagementServerProperties properties = new ManagementServerProperties(); assertThat(properties.getPort()).isNull(); assertThat(properties.getServlet().getContextPath()).isEqualTo(""); - assertThat(properties.getAddApplicationContextHeader()).isEqualTo(false); + assertThat(properties.getAddApplicationContextHeader()).isFalse(); } @Test diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java index a85dab0a92..4dcc7e4685 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java @@ -175,7 +175,7 @@ public class GroovyTemplateAutoConfigurationTests { registerAndRefreshContext( "spring.groovy.template.configuration.auto-indent:true"); assertThat(this.context.getBean(GroovyMarkupConfigurer.class).isAutoIndent()) - .isEqualTo(true); + .isTrue(); } private void registerAndRefreshContext(String... env) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java index cad30e34c0..383f4cfc4f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java @@ -137,7 +137,7 @@ public class DataSourceAutoConfigurationTests { public void commonsDbcp2ValidatesConnectionByDefault() { assertDataSource(org.apache.commons.dbcp2.BasicDataSource.class, Arrays.asList("com.zaxxer.hikari", "org.apache.tomcat"), (dataSource) -> { - assertThat(dataSource.getTestOnBorrow()).isEqualTo(true); + assertThat(dataSource.getTestOnBorrow()).isTrue(); assertThat(dataSource.getValidationQuery()).isNull(); // Use // Connection#isValid() }); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java index 2b645f0c65..49ab43b4ae 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java @@ -114,7 +114,7 @@ public class ActiveMQAutoConfigurationTests { assertThat(connectionFactory.getPassword()).isEqualTo("bar"); assertThat(connectionFactory.getCloseTimeout()).isEqualTo(500); assertThat(connectionFactory.isNonBlockingRedelivery()) - .isEqualTo(true); + .isTrue(); assertThat(connectionFactory.getSendTimeout()).isEqualTo(1000); assertThat(connectionFactory.isTrustAllPackages()).isFalse(); assertThat(connectionFactory.getTrustedPackages()) @@ -178,22 +178,22 @@ public class ActiveMQAutoConfigurationTests { PooledConnectionFactory connectionFactory = context .getBean(PooledConnectionFactory.class); assertThat(connectionFactory.isBlockIfSessionPoolIsFull()) - .isEqualTo(false); + .isFalse(); assertThat(connectionFactory.getBlockIfSessionPoolIsFullTimeout()) .isEqualTo(64); assertThat(connectionFactory.isCreateConnectionOnStartup()) - .isEqualTo(false); + .isFalse(); assertThat(connectionFactory.getExpiryTimeout()).isEqualTo(4096); assertThat(connectionFactory.getIdleTimeout()).isEqualTo(512); assertThat(connectionFactory.getMaxConnections()).isEqualTo(256); assertThat(connectionFactory.getMaximumActiveSessionPerConnection()) .isEqualTo(1024); assertThat(connectionFactory.isReconnectOnException()) - .isEqualTo(false); + .isFalse(); assertThat(connectionFactory.getTimeBetweenExpirationCheckMillis()) .isEqualTo(2048); assertThat(connectionFactory.isUseAnonymousProducers()) - .isEqualTo(false); + .isFalse(); }); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQPropertiesTests.java index 0e76919573..28912d8f26 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQPropertiesTests.java @@ -71,7 +71,7 @@ public class ActiveMQPropertiesTests { this.properties.getPackages().setTrustAll(true); assertThat(createFactory(this.properties) .createConnectionFactory(ActiveMQConnectionFactory.class) - .isTrustAllPackages()).isEqualTo(true); + .isTrustAllPackages()).isTrue(); } @Test @@ -80,7 +80,7 @@ public class ActiveMQPropertiesTests { this.properties.getPackages().getTrusted().add("trusted.package"); ActiveMQConnectionFactory factory = createFactory(this.properties) .createConnectionFactory(ActiveMQConnectionFactory.class); - assertThat(factory.isTrustAllPackages()).isEqualTo(false); + assertThat(factory.isTrustAllPackages()).isFalse(); assertThat(factory.getTrustedPackages().size()).isEqualTo(1); assertThat(factory.getTrustedPackages().get(0)).isEqualTo("trusted.package"); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java index 19cad45ae0..6b5117bbe4 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java @@ -175,11 +175,11 @@ public class ServerPropertiesTests { map.put("server.jetty.accesslog.append", "true"); bind(map); ServerProperties.Jetty jetty = this.properties.getJetty(); - assertThat(jetty.getAccesslog().isEnabled()).isEqualTo(true); + assertThat(jetty.getAccesslog().isEnabled()).isTrue(); assertThat(jetty.getAccesslog().getFilename()).isEqualTo("foo.txt"); assertThat(jetty.getAccesslog().getFileDateFormat()).isEqualTo("yyyymmdd"); assertThat(jetty.getAccesslog().getRetentionPeriod()).isEqualTo(4); - assertThat(jetty.getAccesslog().isAppend()).isEqualTo(true); + assertThat(jetty.getAccesslog().isAppend()).isTrue(); } private void bind(String name, String value) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/TomcatServletWebServerFactoryCustomizerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/TomcatServletWebServerFactoryCustomizerTests.java index 9163464ba2..ff46e05316 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/TomcatServletWebServerFactoryCustomizerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/TomcatServletWebServerFactoryCustomizerTests.java @@ -77,7 +77,7 @@ public class TomcatServletWebServerFactoryCustomizerTests { public void redirectContextRootCanBeConfigured() { bind("server.tomcat.redirect-context-root=false"); ServerProperties.Tomcat tomcat = this.serverProperties.getTomcat(); - assertThat(tomcat.getRedirectContextRoot()).isEqualTo(false); + assertThat(tomcat.getRedirectContextRoot()).isFalse(); TomcatWebServer server = customizeAndGetServer(); Context context = (Context) server.getTomcat().getHost().findChildren()[0]; assertThat(context.getMapperContextRootRedirectEnabled()).isFalse(); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java index 90e9186558..975a4f3f9d 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java @@ -246,7 +246,7 @@ public class LocalDevToolsAutoConfigurationTests { StandardWrapper jspServletWrapper = (StandardWrapper) context.findChild("jsp"); EmbeddedServletOptions options = (EmbeddedServletOptions) ReflectionTestUtils .getField(jspServletWrapper.getServlet(), "options"); - assertThat(options.getDevelopment()).isEqualTo(true); + assertThat(options.getDevelopment()).isTrue(); } private ConfigurableApplicationContext initializeAndRun(Class config, diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java index 5afa66e4cc..9e6f4d72ff 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java @@ -73,7 +73,7 @@ public class DefinitionsParserTests { assertThat(definition.getExtraInterfaces()) .containsExactly(ExampleExtraInterface.class); assertThat(definition.getAnswer()).isEqualTo(Answers.RETURNS_SMART_NULLS); - assertThat(definition.isSerializable()).isEqualTo(true); + assertThat(definition.isSerializable()).isTrue(); assertThat(definition.getReset()).isEqualTo(MockReset.NONE); assertThat(definition.getQualifier()).isNull(); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/DelegatingFilterProxyRegistrationBeanTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/DelegatingFilterProxyRegistrationBeanTests.java index cb190697be..3627f4cd57 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/DelegatingFilterProxyRegistrationBeanTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/DelegatingFilterProxyRegistrationBeanTests.java @@ -91,7 +91,7 @@ public class DelegatingFilterProxyRegistrationBeanTests assertThat(mockFilterInitialized.get()).isNull(); filter.doFilter(new MockHttpServletRequest(), new MockHttpServletResponse(), new MockFilterChain()); - assertThat(mockFilterInitialized.get()).isEqualTo(true); + assertThat(mockFilterInitialized.get()).isTrue(); } @Test diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java index d2a88cf65c..2c08350abb 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java @@ -982,7 +982,7 @@ public abstract class AbstractServletWebServerFactoryTests { JspServlet jspServlet = getJspServlet(); EmbeddedServletOptions options = (EmbeddedServletOptions) ReflectionTestUtils .getField(jspServlet, "options"); - assertThat(options.getDevelopment()).isEqualTo(false); + assertThat(options.getDevelopment()).isFalse(); } @Test