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 Surefire772BothReportsIT
34      extends SurefireJUnit4IntegrationTestCase
35  {
36  
37      public SurefireLauncher unpack()
38      {
39          SurefireLauncher unpack = unpack( "/surefire-772-both-reports" );
40          unpack.maven().deleteSiteDir().skipClean().failNever();
41          return unpack;
42      }
43  
44      @Test
45      public void testReportGeneration()
46          throws Exception
47      {
48          OutputValidator outputValidator =
49              unpack().addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals();
50  
51          TestFile siteFile = outputValidator.getSiteFile( "surefire-report.html" );
52          assertTrue( "Expecting surefire report file", siteFile.isFile() );
53  
54          siteFile = outputValidator.getSiteFile( "failsafe-report.html" );
55          assertTrue( "Expecting failsafe report file", siteFile.isFile() );
56      }
57  
58      @Test
59      public void testSkippedFailsafeReportGeneration()
60          throws Exception
61      {
62          OutputValidator validator = unpack().
63              activateProfile(
64                  "skipFailsafe" ).addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals();
65  
66          TestFile siteFile = validator.getSiteFile( "surefire-report.html" );
67          assertTrue( "Expecting surefire report file", siteFile.isFile() );
68  
69          siteFile = validator.getSiteFile( "failsafe-report.html" );
70          assertFalse( "Expecting no failsafe report file", siteFile.isFile() );
71      }
72  
73      @Test
74      public void testSkippedSurefireReportGeneration()
75          throws Exception
76      {
77          OutputValidator validator = unpack().failNever().
78              activateProfile(
79                  "skipSurefire" ).addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals();
80  
81          TestFile siteFile = validator.getSiteFile( "surefire-report.html" );
82          assertFalse( "Expecting no surefire report file", siteFile.isFile() );
83  
84          siteFile = validator.getSiteFile( "failsafe-report.html" );
85          assertTrue( "Expecting failsafe report file", siteFile.isFile() );
86      }
87  }