View Javadoc

1   package org.apache.maven.surefire.its.jiras;
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 License.
20   */
21  
22  import org.apache.maven.surefire.its.fixture.*;
23  import org.junit.Test;
24  
25  import static org.junit.Assert.assertFalse;
26  import static org.junit.Assert.assertTrue;
27  
28  /**
29   * Test Surefire-740 Truncated comma with non us locale
30   *
31   * @author Kristian Rosenvold
32   */
33  public class Surefire772SpecifiedReportsIT
34      extends SurefireJUnit4IntegrationTestCase
35  {
36      @Test
37      public void testReportGeneration()
38      {
39          OutputValidator validator =
40              unpack().addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals();
41  
42          TestFile siteFile = validator.getSiteFile( "surefire-report.html" );
43          assertTrue( "Expecting surefire report file", siteFile.isFile() );
44  
45          siteFile = validator.getSiteFile( "failsafe-report.html" );
46          assertTrue( "Expecting failsafe report file", siteFile.isFile() );
47      }
48  
49      @Test
50      public void testSkippedFailsafeReportGeneration()
51      {
52          OutputValidator validator = unpack().activateProfile(
53              "skipFailsafe" ).addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals();
54  
55          TestFile siteFile = validator.getSiteFile( "surefire-report.html" );
56          assertTrue( "Expecting surefire report file", siteFile.isFile() );
57  
58          siteFile = validator.getSiteFile( "failsafe-report.html" );
59          assertFalse( "Expecting no failsafe report file", siteFile.isFile() );
60      }
61  
62      @Test
63      public void testSkippedSurefireReportGeneration()
64      {
65          OutputValidator validator = unpack().activateProfile(
66              "skipSurefire" ).addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals();
67  
68          TestFile siteFile = validator.getSiteFile( "surefire-report.html" );
69          assertFalse( "Expecting no surefire report file", siteFile.isFile() );
70  
71          siteFile = validator.getSiteFile( "failsafe-report.html" );
72          assertTrue( "Expecting failsafe report file", siteFile.isFile() );
73      }
74  
75      public SurefireLauncher unpack()
76      {
77          SurefireLauncher unpack = unpack( "/surefire-772-specified-reports" );
78          unpack.maven().deleteSiteDir().skipClean().failNever();
79          return unpack;
80      }
81  
82  }