You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2018/08/27 00:03:29 UTC

[maven-surefire] branch INV1561 updated: more assertions

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

tibordigana pushed a commit to branch INV1561
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git


The following commit(s) were added to refs/heads/INV1561 by this push:
     new 967528a  more assertions
967528a is described below

commit 967528a9593c818f22f5433e610669c542f9c4e3
Author: Tibor17 <ti...@apache.org>
AuthorDate: Mon Aug 27 02:03:21 2018 +0200

    more assertions
---
 .../jiras/Surefire1177TestngParallelSuitesIT.java  | 44 +++-------------------
 1 file changed, 5 insertions(+), 39 deletions(-)

diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1177TestngParallelSuitesIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1177TestngParallelSuitesIT.java
index 6765bf0..80d3a78 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1177TestngParallelSuitesIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1177TestngParallelSuitesIT.java
@@ -25,9 +25,6 @@ import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
 import org.apache.maven.surefire.its.fixture.SurefireLauncher;
 import org.junit.Test;
 
-import java.nio.charset.Charset;
-import java.util.List;
-
 import static org.apache.maven.surefire.its.fixture.HelperAssertions.assumeJavaVersion;
 import static org.hamcrest.Matchers.containsString;
 import static org.hamcrest.Matchers.is;
@@ -43,6 +40,7 @@ public class Surefire1177TestngParallelSuitesIT
     extends SurefireJUnit4IntegrationTestCase
 {
     private static final String EXPECTED_LINE = "TestNGSuiteTest#shouldRunAndPrintItself()";
+    private static final String UNEXPECTED_LINE = "ShouldNotRunTest#shouldNotRun()";
 
     @Test
     public void shouldRunTwoSuitesInParallel()
@@ -50,48 +48,16 @@ public class Surefire1177TestngParallelSuitesIT
     {
         assumeJavaVersion( 1.7d );
 
-        System.out.println( "our encoding = " + Charset.defaultCharset() );
-        System.out.println( asInts( EXPECTED_LINE.toCharArray() ) );
-
         OutputValidator validator = unpack().executeTest().verifyErrorFree( 2 );
 
-        List<String> lines = validator
-                .loadLogLines();
-
-        System.out.println( "lines - 14 : " + lines.get( lines.size() - 14 ) );
-        System.out.println( "lines - 13 : " + lines.get( lines.size() - 13 ) );
-
-        System.out.println( "lines - 14 : " + asInts( lines.get( lines.size() - 14 ).toCharArray() ) );
-        System.out.println( "lines - 13 : " + asInts( lines.get( lines.size() - 13 ).toCharArray() ) );
-
-        System.out.print( lines.get( lines.size() - 14 ).contains( EXPECTED_LINE ) + "\n" );
-        System.out.print( lines.get( lines.size() - 13 ).contains( EXPECTED_LINE ) + "\n" );
-
-        System.out.print( containsString( EXPECTED_LINE ).matches( lines.get( lines.size() - 14 ) ) + "\n" );
-        System.out.print( containsString( EXPECTED_LINE ).matches( lines.get( lines.size() - 13 ) ) + "\n" );
-
-        validator.assertThatLogLine( containsString( EXPECTED_LINE ), is( 2 ) );
-
-                //.assertThatLogLine( containsString( "TestNGSuiteTest#shouldRunAndPrintItself()" ), is( 2 ) );
-            /*.assertThatLogLine( containsString( "ShouldNotRunTest#shouldNotRun()" ), is( 0 ) )
-            .assertThatLogLine( containsString( "TestNGSuiteTest#shouldRunAndPrintItself()" ), is( 2 ) )
-            .assertThatLogLine( is( "TestNGSuiteTest#shouldRunAndPrintItself() 1." ), is( 1 ) )
-            .assertThatLogLine( is( "TestNGSuiteTest#shouldRunAndPrintItself() 2." ), is( 1 ) );*/
+        validator.assertThatLogLine( startsWith( EXPECTED_LINE ), is( 2 ) );
+        validator.assertThatLogLine( is( EXPECTED_LINE + " 1." ), is( 1 ) );
+        validator.assertThatLogLine( is( EXPECTED_LINE + " 2." ), is( 1 ) );
+        validator.assertThatLogLine( containsString( UNEXPECTED_LINE ), is( 0 ) );
     }
 
     private SurefireLauncher unpack()
     {
         return unpack( "testng-parallel-suites" );
     }
-
-    private String asInts( char[] args )
-    {
-        StringBuilder b = new StringBuilder();
-        for ( char arg : args )
-        {
-            b.append( (int) arg )
-            .append( ", " );
-        }
-        return b.toString();
-    }
 }