aboutsummaryrefslogtreecommitdiff
path: root/java/src/test
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2018-09-06 18:18:55 -0400
committerPaul Duncan <pabs@pablotron.org>2018-09-06 18:18:55 -0400
commit878e07414367b4cc69843c3e9d91da02bc7c7043 (patch)
treece9ec236aaa5762139d2e94ddc42f7ec01fb4005 /java/src/test
parentc4f3f955179cd217c6e7273561d06468b33e8973 (diff)
downloadluigi-template-878e07414367b4cc69843c3e9d91da02bc7c7043.tar.bz2
luigi-template-878e07414367b4cc69843c3e9d91da02bc7c7043.zip
java: mv src/main/java/org/pablotron/luigi/{,errors/}*Errors.java and update code
Diffstat (limited to 'java/src/test')
-rw-r--r--java/src/test/java/org/pablotron/luigi/tests/CacheTest.java5
-rw-r--r--java/src/test/java/org/pablotron/luigi/tests/DefaultFiltersTest.java7
-rw-r--r--java/src/test/java/org/pablotron/luigi/tests/ErrorsTest.java44
-rw-r--r--java/src/test/java/org/pablotron/luigi/tests/FiltersTest.java6
-rw-r--r--java/src/test/java/org/pablotron/luigi/tests/TemplateTest.java4
5 files changed, 50 insertions, 16 deletions
diff --git a/java/src/test/java/org/pablotron/luigi/tests/CacheTest.java b/java/src/test/java/org/pablotron/luigi/tests/CacheTest.java
index c91b727..9aff8fc 100644
--- a/java/src/test/java/org/pablotron/luigi/tests/CacheTest.java
+++ b/java/src/test/java/org/pablotron/luigi/tests/CacheTest.java
@@ -4,10 +4,7 @@ import java.util.HashMap;
import org.pablotron.luigi.Template;
import org.pablotron.luigi.Filter;
import org.pablotron.luigi.Cache;
-import org.pablotron.luigi.LuigiError;
-import org.pablotron.luigi.UnknownKeyError;
-import org.pablotron.luigi.UnknownFilterError;
-import org.pablotron.luigi.UnknownTemplateError;
+import org.pablotron.luigi.errors.LuigiError;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertEquals;
diff --git a/java/src/test/java/org/pablotron/luigi/tests/DefaultFiltersTest.java b/java/src/test/java/org/pablotron/luigi/tests/DefaultFiltersTest.java
index c839ded..fe0bc51 100644
--- a/java/src/test/java/org/pablotron/luigi/tests/DefaultFiltersTest.java
+++ b/java/src/test/java/org/pablotron/luigi/tests/DefaultFiltersTest.java
@@ -3,15 +3,12 @@ import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;
-import org.pablotron.luigi.LuigiError;
import org.pablotron.luigi.Template;
import org.pablotron.luigi.Filter;
-import org.pablotron.luigi.FilterError;
-import org.pablotron.luigi.ResultHandler;
+import org.pablotron.luigi.errors.LuigiError;
+import org.pablotron.luigi.errors.FilterError;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
public final class DefaultFiltersTest {
diff --git a/java/src/test/java/org/pablotron/luigi/tests/ErrorsTest.java b/java/src/test/java/org/pablotron/luigi/tests/ErrorsTest.java
new file mode 100644
index 0000000..a88699d
--- /dev/null
+++ b/java/src/test/java/org/pablotron/luigi/tests/ErrorsTest.java
@@ -0,0 +1,44 @@
+import java.util.Map;
+import java.util.HashMap;
+
+import org.pablotron.luigi.Template;
+import org.pablotron.luigi.Cache;
+import org.pablotron.luigi.errors.LuigiError;
+import org.pablotron.luigi.errors.UnknownKeyError;
+import org.pablotron.luigi.errors.UnknownFilterError;
+import org.pablotron.luigi.errors.UnknownTemplateError;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import org.junit.jupiter.api.Test;
+
+public final class ErrorsTest {
+ private static Map<String, String> TEST_ARGS = new HashMap<String, String>() {{
+ put("bar", "foo");
+ }};
+
+ private static Map<String, String> TEST_TEMPLATES = new HashMap<String, String>() {{
+ put("foo", "foo%{bar}foo");
+ }};
+
+ @Test
+ public void testUnknownKeyError() {
+ assertThrows(UnknownKeyError.class, () -> {
+ Template.run("foo%{unknown-key}", TEST_ARGS);
+ });
+ }
+
+ @Test
+ public void testUnknownFilterError() {
+ assertThrows(UnknownFilterError.class, () -> {
+ Template.run("foo%{bar | unknown-filter}", TEST_ARGS);
+ });
+ }
+
+ @Test
+ public void testUnknownTemplateError() {
+ final Cache cache = new Cache(TEST_TEMPLATES);
+ assertThrows(UnknownTemplateError.class, () -> {
+ cache.run("unknown-template", TEST_ARGS);
+ });
+ }
+};
diff --git a/java/src/test/java/org/pablotron/luigi/tests/FiltersTest.java b/java/src/test/java/org/pablotron/luigi/tests/FiltersTest.java
index 9168529..4800318 100644
--- a/java/src/test/java/org/pablotron/luigi/tests/FiltersTest.java
+++ b/java/src/test/java/org/pablotron/luigi/tests/FiltersTest.java
@@ -1,15 +1,13 @@
import java.util.Map;
import java.util.HashMap;
-import org.pablotron.luigi.LuigiError;
import org.pablotron.luigi.Template;
import org.pablotron.luigi.Filter;
-import org.pablotron.luigi.FilterError;
+import org.pablotron.luigi.errors.LuigiError;
+import org.pablotron.luigi.errors.FilterError;
import org.pablotron.luigi.ResultHandler;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
diff --git a/java/src/test/java/org/pablotron/luigi/tests/TemplateTest.java b/java/src/test/java/org/pablotron/luigi/tests/TemplateTest.java
index eadaab1..f4960cc 100644
--- a/java/src/test/java/org/pablotron/luigi/tests/TemplateTest.java
+++ b/java/src/test/java/org/pablotron/luigi/tests/TemplateTest.java
@@ -1,16 +1,14 @@
import java.util.Map;
import java.util.HashMap;
-import org.pablotron.luigi.LuigiError;
import org.pablotron.luigi.Template;
+import org.pablotron.luigi.errors.LuigiError;
import org.pablotron.luigi.ResultHandler;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
-
public final class TemplateTest {
private static final Map<String, String> TEST_ARGS = new HashMap<String, String>() {{
put("bar", "foo");