Repository: maven-surefire Updated Branches: refs/heads/UnicodeTestNamesIT cf280f532 -> 807b41401 (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/807b4140 Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/807b4140 Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/807b4140 Branch: refs/heads/UnicodeTestNamesIT Commit: 807b41401f4678e8e710d350c5312eeb4c5e0f55 Parents: 2f16bc7 Author: Tibor17 <[email protected]> Authored: Thu Jan 4 01:06:04 2018 +0100 Committer: Tibor17 <[email protected]> Committed: Fri Jan 12 03:31:49 2018 +0100 ---------------------------------------------------------------------- surefire-integration-tests/pom.xml | 3 +- .../maven/surefire/its/UnicodeTestNamesIT.java | 50 +++++++++++++------- 2 files changed, 34 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/807b4140/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/807b4140/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..3ec3ba6 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 @@ -19,42 +19,56 @@ package org.apache.maven.surefire.its; * under the LicenseUni. */ -import java.io.File; 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 java.io.File; + +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() ); - File dest = new File( unpacked.getUnpackedAt(), - "src/test/java/junit/twoTestCases/\u800C\u7D22\u5176\u60C5Test.java" ); + OutputValidator outputValidator = + unpacked.executeTest() + .assertTestSuiteResults( 2, 0, 0, 0 ); - Assume.assumeTrue( xxyz.renameTo( dest ) ); - Assume.assumeTrue( dest.exists() ); - Assume.assumeTrue( - !new File( unpacked.getUnpackedAt(), "src/test/java/junit/twoTestCases/????Test.java" ).exists() ); + TestFile surefireReportFile = + outputValidator.getSurefireReportsFile( "junit.twoTestCases.èç´¢å ¶æ Test.txt" ); + assertTrue( surefireReportFile.exists() ); + surefireReportFile.assertContainsText( "junit.twoTestCases.????Test" ); - 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" ); + TestFile surefireXmlReportFile = + outputValidator.getSurefireReportsXmlFile( "TEST-junit.twoTestCases.èç´¢å ¶æ Test.xml" ); + assertTrue( surefireXmlReportFile.exists() ); + assertFalse( surefireXmlReportFile.readFileToString().isEmpty() ); + surefireXmlReportFile.assertContainsText( "junit.twoTestCases.\u800C\u7D22\u5176\u60C5Test" ); } }
