WIP:Ported app to Thymeleaf 3.0.x
authorKai Moritz <kai@juplo.de>
Sat, 15 Feb 2020 13:36:33 +0000 (14:36 +0100)
committerKai Moritz <kai@juplo.de>
Sat, 15 Feb 2020 13:36:33 +0000 (14:36 +0100)
pom.xml
src/test/java/de/juplo/thymeleaf/ImportVariablesAttrProcessorTest.java [deleted file]
src/test/java/de/juplo/thymeleaf/ImportVariablesAttributeProcessorTest.java [new file with mode: 0644]

diff --git a/pom.xml b/pom.xml
index 4001361..e4f6722 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -50,6 +50,7 @@
     <dependency>
       <groupId>org.thymeleaf</groupId>
       <artifactId>thymeleaf</artifactId>
+      <version>${thymeleaf.version}</version>
     </dependency>
 
     <!-- Needed to parse JSON -->
diff --git a/src/test/java/de/juplo/thymeleaf/ImportVariablesAttrProcessorTest.java b/src/test/java/de/juplo/thymeleaf/ImportVariablesAttrProcessorTest.java
deleted file mode 100644 (file)
index d36c26d..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-package de.juplo.thymeleaf;
-
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Scanner;
-import java.util.regex.Matcher;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-
-
-
-/**
- *
- * @author Kai Moritz
- */
-public class ImportVariablesAttrProcessorTest
-{
-  @Test
-  public void testPattern() throws IOException
-  {
-    Matcher matcher;
-
-    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher("{}");
-    assertTrue(matcher.matches());
-    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher(" { } ");
-    assertTrue(matcher.matches());
-    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher("\t{\t}\t");
-    assertTrue(matcher.matches());
-    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher("\n{\n}\n");
-    assertTrue(matcher.matches());
-    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher(" \t\n{ \t\n} \t\n");
-    assertTrue(matcher.matches());
-
-    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher("{\"foo\":\"bar\",\"foobar\":{\"foo\":\"bar\"}");
-    assertTrue(matcher.matches());
-    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher(" { \"foo\":\"bar\", \"foobar\": { \"foo\": \"bar\" } ");
-    assertTrue(matcher.matches());
-    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher("\t{\t\"foo\":\t\"bar\"\t,\t\"foobar\":\t{\t\"foo\":\"bar\"\t}");
-    assertTrue(matcher.matches());
-    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher("\n{\n\"foo\":\n\"bar\"\n,\n\"foobar\":\n{\n\"foo\":\"bar\"\n}");
-    assertTrue(matcher.matches());
-    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher("\n\t {\n\t \"foo\":\n\t \"bar\"\n\t ,\n\t \"foobar\":\n\t {\n\t \"foo\":\"bar\"\n\t }");
-    assertTrue(matcher.matches());
-
-    String json;
-
-    json = read("/json/1.json");
-    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher(json);
-    assertTrue(matcher.matches());
-    json = read("/json/2.json");
-    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher(json);
-    assertTrue(matcher.matches());
-    json = read("/json/3.json");
-    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher(json);
-    assertTrue(matcher.matches());
-
-    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher("foo:bar");
-    assertTrue(matcher.matches());
-    assertNull(matcher.group(1));
-    assertNull(matcher.group(2));
-    assertEquals("foo:bar", matcher.group(3));
-    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher("replace:foo");
-    assertTrue(matcher.matches());
-    assertNull(matcher.group(1));
-    assertNull(matcher.group(2));
-    assertEquals("foo", matcher.group(3));
-    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher("merge:foo");
-    assertTrue(matcher.matches());
-    assertEquals("merge", matcher.group(1));
-    assertNull(matcher.group(2));
-    assertEquals("foo", matcher.group(3));
-  }
-
-
-  String read(String resource)
-  {
-    InputStream is = getClass().getResourceAsStream(resource);
-    return new Scanner(is).useDelimiter("\\Z").next();
-  }
-}
diff --git a/src/test/java/de/juplo/thymeleaf/ImportVariablesAttributeProcessorTest.java b/src/test/java/de/juplo/thymeleaf/ImportVariablesAttributeProcessorTest.java
new file mode 100644 (file)
index 0000000..d23db46
--- /dev/null
@@ -0,0 +1,83 @@
+package de.juplo.thymeleaf;
+
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Scanner;
+import java.util.regex.Matcher;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import org.junit.Test;
+
+
+
+/**
+ *
+ * @author Kai Moritz
+ */
+public class ImportVariablesAttributeProcessorTest
+{
+  @Test
+  public void testPattern() throws IOException
+  {
+    Matcher matcher;
+
+    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher("{}");
+    assertTrue(matcher.matches());
+    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher(" { } ");
+    assertTrue(matcher.matches());
+    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher("\t{\t}\t");
+    assertTrue(matcher.matches());
+    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher("\n{\n}\n");
+    assertTrue(matcher.matches());
+    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher(" \t\n{ \t\n} \t\n");
+    assertTrue(matcher.matches());
+
+    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher("{\"foo\":\"bar\",\"foobar\":{\"foo\":\"bar\"}");
+    assertTrue(matcher.matches());
+    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher(" { \"foo\":\"bar\", \"foobar\": { \"foo\": \"bar\" } ");
+    assertTrue(matcher.matches());
+    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher("\t{\t\"foo\":\t\"bar\"\t,\t\"foobar\":\t{\t\"foo\":\"bar\"\t}");
+    assertTrue(matcher.matches());
+    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher("\n{\n\"foo\":\n\"bar\"\n,\n\"foobar\":\n{\n\"foo\":\"bar\"\n}");
+    assertTrue(matcher.matches());
+    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher("\n\t {\n\t \"foo\":\n\t \"bar\"\n\t ,\n\t \"foobar\":\n\t {\n\t \"foo\":\"bar\"\n\t }");
+    assertTrue(matcher.matches());
+
+    String json;
+
+    json = read("/json/1.json");
+    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher(json);
+    assertTrue(matcher.matches());
+    json = read("/json/2.json");
+    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher(json);
+    assertTrue(matcher.matches());
+    json = read("/json/3.json");
+    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher(json);
+    assertTrue(matcher.matches());
+
+    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher("foo:bar");
+    assertTrue(matcher.matches());
+    assertNull(matcher.group(1));
+    assertNull(matcher.group(2));
+    assertEquals("foo:bar", matcher.group(3));
+    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher("replace:foo");
+    assertTrue(matcher.matches());
+    assertNull(matcher.group(1));
+    assertNull(matcher.group(2));
+    assertEquals("foo", matcher.group(3));
+    matcher = ImportVariablesAttributeProcessor.PATTERN.matcher("merge:foo");
+    assertTrue(matcher.matches());
+    assertEquals("merge", matcher.group(1));
+    assertNull(matcher.group(2));
+    assertEquals("foo", matcher.group(3));
+  }
+
+
+  String read(String resource)
+  {
+    InputStream is = getClass().getResourceAsStream(resource);
+    return new Scanner(is).useDelimiter("\\Z").next();
+  }
+}