summaryrefslogtreecommitdiffstats
path: root/vespaclient-java/src/test/java/com/yahoo/vespavisit/StdOutVisitorHandlerTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'vespaclient-java/src/test/java/com/yahoo/vespavisit/StdOutVisitorHandlerTest.java')
-rw-r--r--vespaclient-java/src/test/java/com/yahoo/vespavisit/StdOutVisitorHandlerTest.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/vespaclient-java/src/test/java/com/yahoo/vespavisit/StdOutVisitorHandlerTest.java b/vespaclient-java/src/test/java/com/yahoo/vespavisit/StdOutVisitorHandlerTest.java
index 53fba8cc5c0..7c68b7c4767 100644
--- a/vespaclient-java/src/test/java/com/yahoo/vespavisit/StdOutVisitorHandlerTest.java
+++ b/vespaclient-java/src/test/java/com/yahoo/vespavisit/StdOutVisitorHandlerTest.java
@@ -37,4 +37,16 @@ public class StdOutVisitorHandlerTest {
String output = out.toString();
assertEquals("", output.trim());
}
+
+ @Test
+ public void printing_zero_documents_produces_empty_output() {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ StdOutVisitorHandler visitorHandler =
+ new StdOutVisitorHandler(/*printIds*/false, false, false, false, false, false, 0, jsonOutput, new PrintStream(out, true));
+ VisitorDataHandler dataHandler = visitorHandler.getDataHandler();
+ dataHandler.onDone();
+ String expectedOutput = jsonOutput ? "[]" : "";
+ String output = out.toString().trim();
+ assertEquals(expectedOutput, output);
+ }
} \ No newline at end of file