use of nl.nn.adapterframework.core.IForwardTarget in project iaf by ibissource.
the class MessageStreamCapTest method testStringCap.
@Test
public void testStringCap() throws Exception {
INamedObject owner = new Owner();
IForwardTarget forward = null;
String responseMessage = "fakeResponseMessage";
StringWriter captureWriter = null;
try (MessageOutputStreamCap cap = new MessageOutputStreamCap(owner, forward)) {
captureWriter = cap.captureCharacterStream();
try (Writer capWriter = cap.asWriter()) {
Object capNative = cap.asNative();
assertEquals(capWriter.getClass(), capNative.getClass());
assertEquals(capWriter, capNative);
capWriter.write(responseMessage);
}
PipeRunResult result = cap.getPipeRunResult();
assertEquals(responseMessage, result.getResult().asString());
}
assertEquals(responseMessage, captureWriter.toString());
}
Aggregations