View Javadoc

1   package org.apache.maven.surefire.its;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the LicenseUni.
20   */
21  
22  import java.io.File;
23  import org.apache.maven.surefire.its.fixture.OutputValidator;
24  import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
25  import org.apache.maven.surefire.its.fixture.SurefireLauncher;
26  import org.apache.maven.surefire.its.fixture.TestFile;
27  
28  import org.junit.Assert;
29  import org.junit.Assume;
30  import org.junit.Test;
31  
32  /**
33   * Verifies unicode filenames pass through correctly.
34   * <p/>
35   * If the underlying file system turns out not to support unicode, we just fail an assumption.s
36   */
37  public class UnicodeTestNamesIT
38      extends SurefireJUnit4IntegrationTestCase
39  {
40      @Test
41      public void checkFileNamesWithUnicode()
42      {
43          SurefireLauncher unpacked = unpack( "unicode-testnames" );
44          File xxyz = new File( unpacked.getUnpackedAt(), "src/test/java/junit/twoTestCases/XXYZTest.java" );
45  
46          File dest = new File( unpacked.getUnpackedAt(),
47                                "src/test/java/junit/twoTestCases/\u800C\u7D22\u5176\u60C5Test.java" );
48  
49          Assume.assumeTrue( xxyz.renameTo( dest ) );
50          Assume.assumeTrue( dest.exists() );
51          Assume.assumeTrue(
52              !new File( unpacked.getUnpackedAt(), "src/test/java/junit/twoTestCases/????Test.java" ).exists() );
53  
54          OutputValidator outputValidator = unpacked.executeTest().assertTestSuiteResults( 2, 0, 0, 0 );
55          TestFile surefireReportsFile = outputValidator.getSurefireReportsFile( "junit.twoTestCases.而索其情Test.txt" );
56          Assert.assertTrue( surefireReportsFile.exists() );
57          //surefireReportsFile .assertContainsText( "junit.twoTestCases.\u800C\u7D22\u5176\u60C5Test.txt" );
58      }
59  
60  }