maven-surefire git commit: UnicodeTestNamesIT should be able to run multiple times [Forced Update!]

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

maven-surefire git commit: UnicodeTestNamesIT should be able to run multiple times [Forced Update!]

Tibor Digana
Repository: maven-surefire
Updated Branches:
  refs/heads/UnicodeTestNamesIT 67c901811 -> 1f63ab1b1 (forced update)


UnicodeTestNamesIT should be able to run multiple times


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/1f63ab1b
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/1f63ab1b
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/1f63ab1b

Branch: refs/heads/UnicodeTestNamesIT
Commit: 1f63ab1b1652a94c9d75dc22971c3619ae826896
Parents: 2f16bc7
Author: Tibor17 <[hidden email]>
Authored: Thu Jan 4 01:06:04 2018 +0100
Committer: Tibor17 <[hidden email]>
Committed: Thu Jan 11 23:01:51 2018 +0100

----------------------------------------------------------------------
 surefire-integration-tests/pom.xml              |  2 +-
 .../maven/surefire/its/UnicodeTestNamesIT.java  | 59 ++++++++++++++------
 2 files changed, 44 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1f63ab1b/surefire-integration-tests/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/pom.xml b/surefire-integration-tests/pom.xml
index 4187d5f..ce3d747 100644
--- a/surefire-integration-tests/pom.xml
+++ b/surefire-integration-tests/pom.xml
@@ -99,7 +99,7 @@
           <forkMode>never</forkMode>
           <argLine>${argLine}</argLine>
           <includes>
-            <include>org/apache/**/*IT*.java</include>
+            <include>org/apache/**/UnicodeTestNamesIT.java</include>
           </includes>
           <!-- Pass current surefire version to the main suite so that it -->
           <!-- can forward to all integration test projects. SUREFIRE-513 -->

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1f63ab1b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/UnicodeTestNamesIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/UnicodeTestNamesIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/UnicodeTestNamesIT.java
index 5470a3f..2afac7b 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/UnicodeTestNamesIT.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/UnicodeTestNamesIT.java
@@ -20,41 +20,68 @@ package org.apache.maven.surefire.its;
  */
 
 import java.io.File;
+import java.io.FilenameFilter;
+import java.util.Arrays;
+
 import org.apache.maven.surefire.its.fixture.OutputValidator;
 import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
 import org.apache.maven.surefire.its.fixture.SurefireLauncher;
 import org.apache.maven.surefire.its.fixture.TestFile;
 
-import org.junit.Assert;
-import org.junit.Assume;
 import org.junit.Test;
 
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeFalse;
+
 /**
  * Verifies unicode filenames pass through correctly.
- * <br>
- * If the underlying file system turns out not to support unicode, we just fail an assumption.s
  */
 public class UnicodeTestNamesIT
-    extends SurefireJUnit4IntegrationTestCase
+        extends SurefireJUnit4IntegrationTestCase
 {
     @Test
     public void checkFileNamesWithUnicode()
     {
         SurefireLauncher unpacked = unpack( "unicode-testnames" );
-        File xxyz = new File( unpacked.getUnpackedAt(), "src/test/java/junit/twoTestCases/XXYZTest.java" );
+        File basedir = unpacked.getUnpackedAt();
+
+        unpacked.execute( "clean" );
+
+        File xxyz = new File( basedir, "src/test/java/junit/twoTestCases/XXYZTest.java" );
+        File dest = new File( basedir, "src/test/java/junit/twoTestCases/\u800C\u7D22\u5176\u60C5Test.java" );
+
+        //noinspection ResultOfMethodCallIgnored
+        dest.delete();
+        assertTrue( xxyz.renameTo( dest ) );
+
+        assertTrue( dest.exists() );
+        assumeFalse( new File( basedir, "src/test/java/junit/twoTestCases/????Test.java" ).exists() );
+
+        OutputValidator outputValidator =
+                unpacked.executeTest()
+                        .assertTestSuiteResults( 2, 0, 0, 0 );
+
+        TestFile surefireReportFile =
+                outputValidator.getSurefireReportsFile( "junit.twoTestCases.而索其情Test.txt" );
+        assertTrue( surefireReportFile.exists() );
+        surefireReportFile.assertContainsText( "junit.twoTestCases.????Test" );
 
-        File dest = new File( unpacked.getUnpackedAt(),
-                              "src/test/java/junit/twoTestCases/\u800C\u7D22\u5176\u60C5Test.java" );
+        TestFile surefireXmlReportFile =
+                outputValidator.getSurefireReportsFile( "TEST-junit.twoTestCases.而索其情Test.xml" );
+        assertTrue( surefireXmlReportFile.exists() );
 
-        Assume.assumeTrue( xxyz.renameTo( dest ) );
-        Assume.assumeTrue( dest.exists() );
-        Assume.assumeTrue(
-            !new File( unpacked.getUnpackedAt(), "src/test/java/junit/twoTestCases/????Test.java" ).exists() );
+        //noinspection ResultOfMethodCallIgnored
+        outputValidator.getSurefireReportsDirectory().listFiles( new FilenameFilter() {
+            @Override
+            public boolean accept( File dir, String name )
+            {
+                System.out.println( name );
+                System.out.println( Arrays.toString( name.getBytes() ) );
+                return false;
+            }
+        } );
 
-        OutputValidator outputValidator = unpacked.executeTest().assertTestSuiteResults( 2, 0, 0, 0 );
-        TestFile surefireReportsFile = outputValidator.getSurefireReportsFile( "junit.twoTestCases.而索其情Test.txt" );
-        Assert.assertTrue( surefireReportsFile.exists() );
-        //surefireReportsFile .assertContainsText( "junit.twoTestCases.\u800C\u7D22\u5176\u60C5Test.txt" );
+        surefireXmlReportFile.assertContainsText( "junit.twoTestCases.而索其情Test" );
     }
 
 }