Stream2StringPipe extends FixedForwardPipe { @Override public PipeRunResult doPipe(Message message, IPipeLineSession session) throws PipeRunException { String result = null; try { result = message.asString(); } catch (IOException e) { throw new PipeRunException(this, "Could not convert stream to text", e); } return new PipeRunResult(getForward(), result); }  @Override PipeRunResult doPipe(Message message, IPipeLineSession session);  }
@Test public void testDoPipeSuccess() throws Exception { String myString = "testString"; InputStream is = new ByteArrayInputStream(myString.getBytes()); Message m = new Message(is); PipeRunResult res = doPipe(pipe, m, session); assertEquals("testString", res.getResult().asString()); }
@Test public void testDoPipeFail() throws Exception { String myString = "testString"; Message m = new Message(myString); PipeRunResult res = doPipe(pipe, m, session); assertEquals("testString", res.getResult().asString()); }