use of java.io.PrintStream in project Cloud9 by lintool.
the class ExceptionUtils method getStackTrace.
public static String getStackTrace(Exception e) {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
PrintStream stream = new PrintStream(bytes);
e.printStackTrace(stream);
return new String(bytes.toByteArray());
}
use of java.io.PrintStream in project camel by apache.
the class StreamSystemOutTest method testStringContent.
// START SNIPPET: e1
@Test
public void testStringContent() throws Exception {
try {
// Given
System.setOut(new PrintStream(mockOut));
// When
template.sendBody("direct:in", message);
// Then
assertEquals(message + System.lineSeparator(), new String(mockOut.toByteArray()));
} finally {
System.setOut(stdOut);
}
}
use of java.io.PrintStream in project camel by apache.
the class StreamSystemOutTest method shouldSkipNullBody.
@Test
public void shouldSkipNullBody() {
try {
// Given
System.setOut(new PrintStream(mockOut));
// When
template.sendBody("direct:in", null);
// Then
assertEquals(0, mockOut.toByteArray().length);
} finally {
System.setOut(stdOut);
}
}
use of java.io.PrintStream in project byte-buddy by raphw.
the class AgentBuilderListenerTest method testStreamWritingOnIgnore.
@Test
public void testStreamWritingOnIgnore() throws Exception {
PrintStream printStream = mock(PrintStream.class);
AgentBuilder.Listener listener = new AgentBuilder.Listener.StreamWriting(printStream);
listener.onIgnored(typeDescription, classLoader, module, LOADED);
verify(printStream).printf("[Byte Buddy] IGNORE %s [%s, %s, loaded=%b]%n", FOO, classLoader, module, LOADED);
verifyNoMoreInteractions(printStream);
}
use of java.io.PrintStream in project byte-buddy by raphw.
the class AgentBuilderListenerTest method testStreamWritingOnComplete.
@Test
public void testStreamWritingOnComplete() throws Exception {
PrintStream printStream = mock(PrintStream.class);
AgentBuilder.Listener listener = new AgentBuilder.Listener.StreamWriting(printStream);
listener.onComplete(FOO, classLoader, module, LOADED);
verify(printStream).printf("[Byte Buddy] COMPLETE %s [%s, %s, loaded=%b]%n", FOO, classLoader, module, LOADED);
verifyNoMoreInteractions(printStream);
}
Aggregations