Coverage Report - org.apache.maven.plugins.surefire.report.ReportTestSuite
 
Classes in this File Line Coverage Branch Coverage Complexity
ReportTestSuite
95%
37/39
83%
5/6
1.263
 
 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.util.ArrayList;
 23  
 import java.util.List;
 24  
 
 25  
 /**
 26  
  * @version $Id: ReportTestSuite.java 1050534 2010-12-17 23:54:50Z hboutemy $
 27  
  */
 28  28
 public class ReportTestSuite
 29  
 {
 30  28
     private List testCases = new ArrayList();
 31  
 
 32  
     private int numberOfErrors;
 33  
 
 34  
     private int numberOfFailures;
 35  
 
 36  
     private int numberOfSkipped;
 37  
 
 38  
     private Integer numberOfTests;
 39  
 
 40  
     private String name;
 41  
 
 42  
     private String fullClassName;
 43  
 
 44  
     private String packageName;
 45  
 
 46  
     private float timeElapsed;
 47  
 
 48  
     public List getTestCases()
 49  
     {
 50  76
         return this.testCases;
 51  
     }
 52  
 
 53  
     public int getNumberOfErrors()
 54  
     {
 55  29
         return numberOfErrors;
 56  
     }
 57  
 
 58  
     public void setNumberOfErrors( int numberOfErrors )
 59  
     {
 60  8
         this.numberOfErrors = numberOfErrors;
 61  8
     }
 62  
 
 63  
     public int getNumberOfFailures()
 64  
     {
 65  28
         return numberOfFailures;
 66  
     }
 67  
 
 68  
     public void setNumberOfFailures( int numberOfFailures )
 69  
     {
 70  12
         this.numberOfFailures = numberOfFailures;
 71  12
     }
 72  
 
 73  
     public int getNumberOfSkipped()
 74  
     {
 75  19
         return numberOfSkipped;
 76  
     }
 77  
 
 78  
     public void setNumberOfSkipped( int numberOfSkipped )
 79  
     {
 80  3
         this.numberOfSkipped = numberOfSkipped;
 81  3
     }
 82  
 
 83  
     public int getNumberOfTests()
 84  
     {
 85  20
         if ( numberOfTests != null )
 86  
         {
 87  3
             return numberOfTests.intValue();
 88  
         }
 89  17
         if ( testCases != null )
 90  
         {
 91  17
             return testCases.size();
 92  
         }
 93  0
         return 0;
 94  
     }
 95  
 
 96  
     public void setNumberOfTests( int numberOfTests )
 97  
     {
 98  3
         this.numberOfTests = new Integer( numberOfTests );
 99  3
     }
 100  
 
 101  
     public String getName()
 102  
     {
 103  94
         return name;
 104  
     }
 105  
 
 106  
     public void setName( String name )
 107  
     {
 108  1
         this.name = name;
 109  1
     }
 110  
 
 111  
     public String getFullClassName()
 112  
     {
 113  126
         return fullClassName;
 114  
     }
 115  
 
 116  
     public void setFullClassName( String fullClassName )
 117  
     {
 118  13
         this.fullClassName = fullClassName;
 119  13
         int lastDotPosition = fullClassName.lastIndexOf( "." );
 120  
 
 121  13
         name = fullClassName.substring( lastDotPosition + 1, fullClassName.length() );
 122  
 
 123  13
         if ( lastDotPosition < 0 )
 124  
         {
 125  
             /* no package name */
 126  2
             packageName = "";
 127  
         }
 128  
         else
 129  
         {
 130  11
             packageName = fullClassName.substring( 0, lastDotPosition );
 131  
         }
 132  13
     }
 133  
 
 134  
     public String getPackageName()
 135  
     {
 136  36
         return packageName;
 137  
     }
 138  
 
 139  
     public void setPackageName( String packageName )
 140  
     {
 141  4
         this.packageName = packageName;
 142  4
     }
 143  
 
 144  
     public float getTimeElapsed()
 145  
     {
 146  17
         return this.timeElapsed;
 147  
     }
 148  
 
 149  
     public void setTimeElapsed( float timeElapsed )
 150  
     {
 151  17
         this.timeElapsed = timeElapsed;
 152  17
     }
 153  
 
 154  
     public void setTestCases( List testCases )
 155  
     {
 156  3
         this.testCases = testCases;
 157  3
     }
 158  
 
 159  
     /** {@inheritDoc} */
 160  
     public String toString()
 161  
     {
 162  0
         return fullClassName + " [" + getNumberOfTests() + "/" + getNumberOfFailures() + "/" + getNumberOfErrors()
 163  
             + "/" + getNumberOfSkipped() + "]";
 164  
     }
 165  
 }