This is an automated email from the ASF dual-hosted git repository.

bmarwell pushed a commit to branch 1.7.x
in repository https://gitbox.apache.org/repos/asf/shiro.git

commit c539537ab90f56fdb38066e7177184b189106015
Author: Brian Demers <[email protected]>
AuthorDate: Mon Nov 9 14:18:04 2020 -0500

    Add basic tests to assert no whitespace in spring.factories fiels
---
 .../boot/autoconfigure/SpringFactoriesTest.groovy  | 24 ++++++++++++++++++++++
 .../web/WebSpringFactoriesTest.groovy              | 24 ++++++++++++++++++++++
 2 files changed, 48 insertions(+)

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 0000000..43dba27
--- /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 0000000..b0892a1
--- /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.*"))
+        }
+    }
+}

Reply via email to