use of org.apache.maven.surefire.report.ConsoleOutputReceiver in project junit5 by junit-team.
the class JUnitPlatformProviderTests method outputIsCaptured.
@Test
void outputIsCaptured() throws Exception {
Launcher launcher = LauncherFactory.create();
RunListener runListener = runListenerMock();
JUnitPlatformProvider provider = new JUnitPlatformProvider(providerParametersMock(runListener), launcher);
invokeProvider(provider, VerboseTestClass.class);
ArgumentCaptor<byte[]> captor = ArgumentCaptor.forClass(byte[].class);
// @formatter:off
verify((ConsoleOutputReceiver) runListener).writeTestOutput(captor.capture(), eq(0), gt(6), eq(true));
verify((ConsoleOutputReceiver) runListener).writeTestOutput(captor.capture(), eq(0), gt(6), eq(false));
assertThat(captor.getAllValues()).extracting(bytes -> new String(bytes, 0, 6)).containsExactly("stdout", "stderr");
// @formatter:on
}
Aggregations