diff --git a/support/spring-boot/spring-boot-starter/src/test/groovy/org/apache/shiro/spring/boot/autoconfigure/SpringFactoriesTest.groovy b/support/spring-boot/spring-boot-starter/src/test/groovy/org/apache/shiro/spring/boot/autoconfigure/SpringFactoriesTest.groovy new file mode 100644 index 0000000000..43dba2730d --- /dev/null +++ b/support/spring-boot/spring-boot-starter/src/test/groovy/org/apache/shiro/spring/boot/autoconfigure/SpringFactoriesTest.groovy @@ -0,0 +1,24 @@ +package org.apache.shiro.spring.boot.autoconfigure + +import org.junit.Test + +import static org.hamcrest.MatcherAssert.assertThat +import static org.hamcrest.Matchers.matchesPattern +import static org.hamcrest.Matchers.not + +class SpringFactoriesTest { + + @Test + void springFactoriesConfigContainsNoWhitespace() { + Properties props = new Properties() + props.load(new FileReader("src/main/resources/META-INF/spring.factories")) + assertNoWhitespaceInEntries(props) + } + + static private assertNoWhitespaceInEntries(Properties props) { + props.each{ key, val -> + assertThat "Property [${key}] contains whitespace", + props.get("org.springframework.boot.autoconfigure.EnableAutoConfiguration"), not(matchesPattern(".*\\s.*")) + } + } +} diff --git a/support/spring-boot/spring-boot-web-starter/src/test/groovy/org/apache/shiro/spring/boot/autoconfigure/web/WebSpringFactoriesTest.groovy b/support/spring-boot/spring-boot-web-starter/src/test/groovy/org/apache/shiro/spring/boot/autoconfigure/web/WebSpringFactoriesTest.groovy new file mode 100644 index 0000000000..b0892a13ea --- /dev/null +++ b/support/spring-boot/spring-boot-web-starter/src/test/groovy/org/apache/shiro/spring/boot/autoconfigure/web/WebSpringFactoriesTest.groovy @@ -0,0 +1,24 @@ +package org.apache.shiro.spring.boot.autoconfigure.web + +import org.junit.Test + +import static org.hamcrest.MatcherAssert.assertThat +import static org.hamcrest.Matchers.matchesPattern +import static org.hamcrest.Matchers.not + +class WebSpringFactoriesTest { + + @Test + void springFactoriesConfigContainsNoWhitespace() { + Properties props = new Properties() + props.load(new FileReader("src/main/resources/META-INF/spring.factories")) + assertNoWhitespaceInEntries(props) + } + + static private assertNoWhitespaceInEntries(Properties props) { + props.each{ key, val -> + assertThat "Property [${key}] contains whitespace", + props.get("org.springframework.boot.autoconfigure.EnableAutoConfiguration"), not(matchesPattern(".*\\s.*")) + } + } +}