Skip to content

Commit

Permalink
o Restaured the test to its previous state
Browse files Browse the repository at this point in the history
o configured surefire not to run parallel tests, it makes some test
faili due to the use of system.out (which is shared across the JVM)
  • Loading branch information
elecharny committed May 7, 2019
1 parent c787edb commit 89845cc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
10 changes: 10 additions & 0 deletions util/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@

<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<configuration>
<systemPropertyVariables>
<workingDirectory>${basedir}/target</workingDirectory>
</systemPropertyVariables>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,27 @@ public void testPrintStacktracePrintWriterDoesNotWriteToSystemOutErr()
assertThat( customOut.toString(), containsString( "nested1" ) );
assertThat( customOut.toString(), containsString( "nested2" ) );
assertThat( systemOut.size(), equalTo( 0 ) );
}


ByteArrayOutputStream systemOut2 = new ByteArrayOutputStream();
PrintStream systemPrintStream2 = new PrintStream( systemOut2 );
System.setOut( systemPrintStream2 );
System.setErr( systemPrintStream2 );
@Test
public void testPrintStacktraceToPrintStreamDoesNotWriteToSystemOutErr()
{
ByteArrayOutputStream systemOut = new ByteArrayOutputStream();
PrintStream systemPrintStream = new PrintStream( systemOut );
System.setOut( systemPrintStream );
System.setErr( systemPrintStream );

ByteArrayOutputStream customOut2 = new ByteArrayOutputStream();
PrintStream customPrintWriter2 = new PrintStream( customOut2 );
runtimeMultiException = new RuntimeMultiException( "multi" );
ByteArrayOutputStream customOut = new ByteArrayOutputStream();
PrintStream customPrintWriter = new PrintStream( customOut );
RuntimeMultiException runtimeMultiException = new RuntimeMultiException( "multi" );
runtimeMultiException.addThrowable( new Exception( "nested1" ) );
runtimeMultiException.addThrowable( new Exception( "nested2" ) );
runtimeMultiException.printStackTrace( customPrintWriter2 );
runtimeMultiException.printStackTrace( customPrintWriter );

assertThat( customOut2.toString(), containsString( "multi" ) );
assertThat( customOut2.toString(), containsString( "nested1" ) );
assertThat( customOut2.toString(), containsString( "nested2" ) );
assertThat( systemOut2.size(), equalTo( 0 ) );
assertThat( customOut.toString(), containsString( "multi" ) );
assertThat( customOut.toString(), containsString( "nested1" ) );
assertThat( customOut.toString(), containsString( "nested2" ) );
assertThat( systemOut.size(), equalTo( 0 ) );
}
}

0 comments on commit 89845cc

Please sign in to comment.