Coverage Report - org.apache.maven.plugins.surefire.report.SurefireReportMojo
 
Classes in this File Line Coverage Branch Coverage Complexity
SurefireReportMojo
66%
4/6
N/A
1
 
 1  
 package org.apache.maven.plugins.surefire.report;
 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 java.io.File;
 23  
 import org.apache.maven.project.MavenProject;
 24  
 
 25  
 
 26  
 /**
 27  
  * Creates a nicely formatted Surefire Test Report in html format.
 28  
  *
 29  
  * @author <a href="mailto:jruiz@exist.com">Johnny R. Ruiz III</a>
 30  
  * @goal report
 31  
  * @execute phase="test" lifecycle="surefire"
 32  
  */
 33  4
 public class SurefireReportMojo
 34  
     extends AbstractSurefireReportMojo
 35  
 {
 36  
 
 37  
     /**
 38  
      * The filename to use for the report.
 39  
      *
 40  
      * @parameter expression="${outputName}" default-value="surefire-report"
 41  
      * @required
 42  
      * @noinspection UnusedDeclaration
 43  
      */
 44  
     private String outputName;
 45  
 
 46  
     /**
 47  
      * If set to true the surefire report will be generated even when there are no surefire result files.
 48  
      * Defaulyts to <code>true</code> to preserve legacy behaviour pre 2.10.
 49  
      *
 50  
      * @parameter expression="${alwaysGenerateSurefireReport}" default-value="true"
 51  
      * @noinspection UnusedDeclaration
 52  
      * @since 2.11
 53  
      */
 54  
     private boolean alwaysGenerateSurefireReport;
 55  
 
 56  
     /**
 57  
      * If set to true the surefire report generation will be skipped.
 58  
      *
 59  
      * @parameter expression="${skipSurefireReport}" default-value="false"
 60  
      * @noinspection UnusedDeclaration
 61  
      * @since 2.11
 62  
      */
 63  
     private boolean skipSurefireReport;
 64  
 
 65  
     protected File getSurefireReportsDirectory( MavenProject subProject )
 66  
     {
 67  0
         String buildDir = subProject.getBuild().getDirectory();
 68  0
         return new File( buildDir + "/surefire-reports" );
 69  
     }
 70  
 
 71  
     public String getOutputName()
 72  
     {
 73  4
         return outputName;
 74  
     }
 75  
 
 76  
     protected boolean isSkipped()
 77  
     {
 78  12
         return skipSurefireReport;
 79  
     }
 80  
 
 81  
     protected boolean isGeneratedWhenNoResults()
 82  
     {
 83  12
         return alwaysGenerateSurefireReport;
 84  
     }
 85  
 }