From 64c324612e9690ee477bebb5d2532bb5843fbdd2 Mon Sep 17 00:00:00 2001 From: Raja Kolli Date: Fri, 26 Jan 2018 01:30:43 +0530 Subject: [PATCH 1/2] Polish See gh-11783 --- .../data/ldap/DataLdapTestIntegrationTests.java | 2 +- .../boot/web/servlet/server/StaticResourceJars.java | 13 +++++-------- ...figurationPropertyValueFailureAnalyzerTests.java | 4 ++-- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTestIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTestIntegrationTests.java index d667eb08df..674e209132 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTestIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTestIntegrationTests.java @@ -62,7 +62,7 @@ public class DataLdapTestIntegrationTests { public void testRepository() { LdapQuery ldapQuery = LdapQueryBuilder.query().where("cn").is("Bob Smith"); Optional entry = this.exampleRepository.findOne(ldapQuery); - assertThat(entry.isPresent()); + assertThat(entry.isPresent()).isTrue(); assertThat(entry.get().getDn()).isEqualTo(LdapUtils .newLdapName("cn=Bob Smith,ou=company1,c=Sweden,dc=spring,dc=org")); assertThat(this.ldapTemplate.findOne(ldapQuery, ExampleEntry.class).getDn()) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/StaticResourceJars.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/StaticResourceJars.java index 304b255798..c95940764a 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/StaticResourceJars.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/StaticResourceJars.java @@ -79,19 +79,16 @@ class StaticResourceJars { } private void addUrlFile(List urls, URL url, File file) { - if (file.isDirectory() && new File(file, "META-INF/resources").isDirectory()) { - urls.add(url); - } - else if (isResourcesJar(file)) { + if ((file.isDirectory() && new File(file, "META-INF/resources").isDirectory()) + || isResourcesJar(file)) { urls.add(url); } } private void addUrlConnection(List urls, URL url, URLConnection connection) { - if (connection instanceof JarURLConnection) { - if (isResourcesJar((JarURLConnection) connection)) { - urls.add(url); - } + if (connection instanceof JarURLConnection + && isResourcesJar((JarURLConnection) connection)) { + urls.add(url); } } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/InvalidConfigurationPropertyValueFailureAnalyzerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/InvalidConfigurationPropertyValueFailureAnalyzerTests.java index 6eab25b83f..984904f60f 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/InvalidConfigurationPropertyValueFailureAnalyzerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/InvalidConfigurationPropertyValueFailureAnalyzerTests.java @@ -113,8 +113,8 @@ public class InvalidConfigurationPropertyValueFailureAnalyzerTests { FailureAnalysis analysis) { assertThat(analysis.getDescription()).contains("test.property") .contains("invalid").contains("TestOrigin test.property"); - assertThat(analysis.getAction() - .contains("Review the value of the property with the provided reason.")); + assertThat(analysis.getAction()) + .contains("Review the value of the property with the provided reason."); assertThat(analysis.getCause()).isSameAs(failure); } From 3f1aaa1f7e4d67969f6c95922c94ab5d5dd461db Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Fri, 26 Jan 2018 09:54:13 +0100 Subject: [PATCH 2/2] Polish contribution Closes gh-11783 --- .../data/ldap/DataLdapTestIntegrationTests.java | 2 +- .../boot/web/servlet/server/StaticResourceJars.java | 2 +- ...idConfigurationPropertyValueFailureAnalyzerTests.java | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTestIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTestIntegrationTests.java index 674e209132..458525bf6f 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTestIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTestIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/StaticResourceJars.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/StaticResourceJars.java index c95940764a..74ca4d7214 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/StaticResourceJars.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/StaticResourceJars.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/InvalidConfigurationPropertyValueFailureAnalyzerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/InvalidConfigurationPropertyValueFailureAnalyzerTests.java index 984904f60f..563fe7d675 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/InvalidConfigurationPropertyValueFailureAnalyzerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/InvalidConfigurationPropertyValueFailureAnalyzerTests.java @@ -58,6 +58,8 @@ public class InvalidConfigurationPropertyValueFailureAnalyzerTests { "test.property", "invalid", "This is not valid."); FailureAnalysis analysis = performAnalysis(failure); assertCommonParts(failure, analysis); + assertThat(analysis.getAction()) + .contains("Review the value of the property with the provided reason."); assertThat(analysis.getDescription()) .contains("Validation failed for the following reason") .contains("This is not valid.") @@ -73,7 +75,8 @@ public class InvalidConfigurationPropertyValueFailureAnalyzerTests { InvalidConfigurationPropertyValueException failure = new InvalidConfigurationPropertyValueException( "test.property", "invalid", null); FailureAnalysis analysis = performAnalysis(failure); - assertCommonParts(failure, analysis); + assertThat(analysis.getAction()) + .contains("Review the value of the property."); assertThat(analysis.getDescription()).contains("No reason was provided.") .doesNotContain("Additionally, this property is also set"); } @@ -95,6 +98,8 @@ public class InvalidConfigurationPropertyValueFailureAnalyzerTests { "test.property", "invalid", "This is not valid."); FailureAnalysis analysis = performAnalysis(failure); assertCommonParts(failure, analysis); + assertThat(analysis.getAction()) + .contains("Review the value of the property with the provided reason."); assertThat(analysis.getDescription()) .contains("Additionally, this property is also set in the following " + "property sources:") @@ -113,8 +118,6 @@ public class InvalidConfigurationPropertyValueFailureAnalyzerTests { FailureAnalysis analysis) { assertThat(analysis.getDescription()).contains("test.property") .contains("invalid").contains("TestOrigin test.property"); - assertThat(analysis.getAction()) - .contains("Review the value of the property with the provided reason."); assertThat(analysis.getCause()).isSameAs(failure); }