@Test @Category(NeedsRunner.class) public void testReadStringsWithCustomDelimiter() throws Exception { final String[] inputStrings = new String[] { // incomplete delimiter "To be, or not to be: that |is the question: ", // incomplete delimiter "To be, or not to be: that *is the question: ", // complete delimiter "Whether 'tis nobler in the mind to suffer |*", // truncated delimiter "The slings and arrows of outrageous fortune,|" }; File tmpFile = tempFolder.newFile("tmpfile.txt"); String filename = tmpFile.getPath(); try (Writer writer = Files.newBufferedWriter(tmpFile.toPath(), UTF_8)) { writer.write(Joiner.on("").join(inputStrings)); } PAssert.that(p.apply(TextIO.read().from(filename).withDelimiter(new byte[] {'|', '*'}))) .containsInAnyOrder( "To be, or not to be: that |is the question: To be, or not to be: " + "that *is the question: Whether 'tis nobler in the mind to suffer ", "The slings and arrows of outrageous fortune,|"); p.run(); }