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