Repository: maven-surefire Updated Branches: refs/heads/UnicodeTestNamesIT 6b6e8bf89 -> 7dbf1f33a (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/7dbf1f33 Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/7dbf1f33 Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/7dbf1f33 Branch: refs/heads/UnicodeTestNamesIT Commit: 7dbf1f33a9d33c1d060fe7c4b0c630607d45f98a Parents: 2f16bc7 Author: Tibor17 <[email protected]> Authored: Thu Jan 4 01:06:04 2018 +0100 Committer: Tibor17 <[email protected]> Committed: Fri Jan 12 03:03:06 2018 +0100 ---------------------------------------------------------------------- surefire-integration-tests/pom.xml | 3 +- .../maven/surefire/its/UnicodeTestNamesIT.java | 63 +++++++++++++++----- 2 files changed, 49 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7dbf1f33/surefire-integration-tests/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/pom.xml b/surefire-integration-tests/pom.xml index 4187d5f..a8468d0 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 --> @@ -119,6 +119,7 @@ <jdk.home>${jdk.home}</jdk.home> </systemPropertyVariables> <redirectTestOutputToFile>false</redirectTestOutputToFile> + <useFile>false</useFile> </configuration> <dependencies> <dependency> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7dbf1f33/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..ccf393a 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,72 @@ 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.assertFalse; +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() ); + System.out.println( surefireXmlReportFile.readFileToString() ); + assertFalse( surefireXmlReportFile.readFileToString().isEmpty() ); - 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" ); + throw new RuntimeException( "test passed successfully - show the log" ); } }
