You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2019/05/07 05:31:53 UTC

[directory-ldap-api] branch master updated: o Restaured the test to its previous state 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)

This is an automated email from the ASF dual-hosted git repository.

elecharny pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-ldap-api.git


The following commit(s) were added to refs/heads/master by this push:
     new 89845cc  o Restaured the test to its previous state 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)
89845cc is described below

commit 89845cc7855502872b385a66d45ac786206a6f0f
Author: emmanuel lecharny <el...@apache.org>
AuthorDate: Tue May 7 07:31:49 2019 +0200

    o Restaured the test to its previous state
    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)
---
 util/pom.xml                                       | 10 ++++++++
 .../util/exception/RuntimeMultiExceptionTest.java  | 29 +++++++++++++---------
 2 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/util/pom.xml b/util/pom.xml
index 862f78b..ed46b48 100644
--- a/util/pom.xml
+++ b/util/pom.xml
@@ -70,6 +70,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>
         <inherited>true</inherited>
diff --git a/util/src/test/java/org/apache/directory/api/util/exception/RuntimeMultiExceptionTest.java b/util/src/test/java/org/apache/directory/api/util/exception/RuntimeMultiExceptionTest.java
index a935beb..f2833e3 100644
--- a/util/src/test/java/org/apache/directory/api/util/exception/RuntimeMultiExceptionTest.java
+++ b/util/src/test/java/org/apache/directory/api/util/exception/RuntimeMultiExceptionTest.java
@@ -78,22 +78,27 @@ public class RuntimeMultiExceptionTest
         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 ) );
     }
 }
\ No newline at end of file