summaryrefslogtreecommitdiff
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.java7
-rw-r--r--java/src/test/java/org/pablotron/luigi/tests/FiltersTest.java1
-rw-r--r--java/src/test/java/org/pablotron/luigi/tests/TemplateTest.java6
-rw-r--r--java/src/test/java/org/pablotron/luigi/tests/TestResultHandler.java21
4 files changed, 25 insertions, 10 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 f0e2ab5..f59d2b8 100644
--- a/java/src/test/java/org/pablotron/luigi/tests/CacheTest.java
+++ b/java/src/test/java/org/pablotron/luigi/tests/CacheTest.java
@@ -2,6 +2,7 @@ package org.pablotron.luigi.tests;
import java.util.Map;
import java.util.HashMap;
+import java.io.IOException;
import org.pablotron.luigi.Template;
import org.pablotron.luigi.Filter;
@@ -31,20 +32,20 @@ public final class CacheTest {
}};
@Test
- public void testCache() throws LuigiError {
+ public void testCache() throws LuigiError, IOException {
final Cache cache = new Cache(TEST_TEMPLATES);
assertEquals("foofoofoo", cache.run("foo", TEST_ARGS));
}
@Test
- public void testCacheWithCustomFilters() throws LuigiError {
+ public void testCacheWithCustomFilters() throws LuigiError, IOException {
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 {
+ public void testCacheGetWithResultHandler() throws LuigiError, IOException {
final Cache cache = new Cache(TEST_TEMPLATES);
final StringBuilder sb = new StringBuilder();
final TestResultHandler rh = new TestResultHandler(sb);
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 4800318..25034b0 100644
--- a/java/src/test/java/org/pablotron/luigi/tests/FiltersTest.java
+++ b/java/src/test/java/org/pablotron/luigi/tests/FiltersTest.java
@@ -5,7 +5,6 @@ import org.pablotron.luigi.Template;
import org.pablotron.luigi.Filter;
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 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 83a137d..9862ae1 100644
--- a/java/src/test/java/org/pablotron/luigi/tests/TemplateTest.java
+++ b/java/src/test/java/org/pablotron/luigi/tests/TemplateTest.java
@@ -2,10 +2,10 @@ package org.pablotron.luigi.tests;
import java.util.Map;
import java.util.HashMap;
+import java.io.IOException;
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;
@@ -44,7 +44,7 @@ public final class TemplateTest {
}
@Test
- public void testResultHandler() throws LuigiError {
+ public void testResultHandler() throws LuigiError, IOException {
final Template t = new Template("foo%{bar}");
final StringBuilder sb = new StringBuilder();
final TestResultHandler rh = new TestResultHandler(sb);
@@ -56,7 +56,7 @@ public final class TemplateTest {
}
@Test
- public void testStaticResultHandler() throws LuigiError {
+ public void testStaticResultHandler() throws LuigiError, IOException {
final StringBuilder sb = new StringBuilder();
final TestResultHandler rh = new TestResultHandler(sb);
diff --git a/java/src/test/java/org/pablotron/luigi/tests/TestResultHandler.java b/java/src/test/java/org/pablotron/luigi/tests/TestResultHandler.java
index a847e79..d924cff 100644
--- a/java/src/test/java/org/pablotron/luigi/tests/TestResultHandler.java
+++ b/java/src/test/java/org/pablotron/luigi/tests/TestResultHandler.java
@@ -1,15 +1,30 @@
package org.pablotron.luigi.tests;
-import org.pablotron.luigi.ResultHandler;
+import java.io.IOException;
-public final class TestResultHandler implements ResultHandler {
+public final class TestResultHandler implements Appendable {
private final StringBuilder sb;
public TestResultHandler(final StringBuilder sb) {
this.sb = sb;
}
- public void append(final String s) {
+ public Appendable append(final char c) throws IOException {
+ sb.append(c);
+ return this;
+ }
+
+ public Appendable append(final CharSequence s) throws IOException {
sb.append(s);
+ return this;
+ }
+
+ public Appendable append(
+ final CharSequence s,
+ final int start,
+ final int end
+ ) throws IOException {
+ sb.append(s, start, end);
+ return this;
}
};