aboutsummaryrefslogtreecommitdiff
path: root/java/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/test')
-rw-r--r--java/src/test/java/org/pablotron/luigi/tests/CacheTest.java13
-rw-r--r--java/src/test/java/org/pablotron/luigi/tests/TemplateTest.java13
-rw-r--r--java/src/test/java/org/pablotron/luigi/tests/TestResultHandler.java15
3 files changed, 30 insertions, 11 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 9aff8fc..f0e2ab5 100644
--- a/java/src/test/java/org/pablotron/luigi/tests/CacheTest.java
+++ b/java/src/test/java/org/pablotron/luigi/tests/CacheTest.java
@@ -1,3 +1,5 @@
+package org.pablotron.luigi.tests;
+
import java.util.Map;
import java.util.HashMap;
@@ -40,4 +42,15 @@ public final class CacheTest {
final Cache cache = new Cache(TEST_TEMPLATES, TEST_FILTERS);
assertEquals("foo-custom-foo-filter-foo", cache.run("foo-custom", TEST_ARGS));
}
+
+ @Test
+ public void testCacheGetWithResultHandler() throws LuigiError {
+ final Cache cache = new Cache(TEST_TEMPLATES);
+ final StringBuilder sb = new StringBuilder();
+ final TestResultHandler rh = new TestResultHandler(sb);
+ cache.run("foo", TEST_ARGS, rh);
+
+ assertEquals("foofoofoo", sb.toString());
+ }
+
};
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 f4960cc..83a137d 100644
--- a/java/src/test/java/org/pablotron/luigi/tests/TemplateTest.java
+++ b/java/src/test/java/org/pablotron/luigi/tests/TemplateTest.java
@@ -1,3 +1,5 @@
+package org.pablotron.luigi.tests;
+
import java.util.Map;
import java.util.HashMap;
@@ -41,17 +43,6 @@ public final class TemplateTest {
assertEquals("foofoo", r);
}
- private static final class TestResultHandler implements ResultHandler {
- private final StringBuilder sb;
- public TestResultHandler(final StringBuilder sb) {
- this.sb = sb;
- }
-
- public void append(final String s) {
- sb.append(s);
- }
- };
-
@Test
public void testResultHandler() throws LuigiError {
final Template t = new Template("foo%{bar}");
diff --git a/java/src/test/java/org/pablotron/luigi/tests/TestResultHandler.java b/java/src/test/java/org/pablotron/luigi/tests/TestResultHandler.java
new file mode 100644
index 0000000..a847e79
--- /dev/null
+++ b/java/src/test/java/org/pablotron/luigi/tests/TestResultHandler.java
@@ -0,0 +1,15 @@
+package org.pablotron.luigi.tests;
+
+import org.pablotron.luigi.ResultHandler;
+
+public final class TestResultHandler implements ResultHandler {
+ private final StringBuilder sb;
+
+ public TestResultHandler(final StringBuilder sb) {
+ this.sb = sb;
+ }
+
+ public void append(final String s) {
+ sb.append(s);
+ }
+};