View Javadoc

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   *
27   */
28  public class ReportTestSuite
29  {
30      private List<ReportTestCase> testCases = new ArrayList<ReportTestCase>();
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<ReportTestCase> getTestCases()
49      {
50          return this.testCases;
51      }
52  
53      public int getNumberOfErrors()
54      {
55          return numberOfErrors;
56      }
57  
58      public void setNumberOfErrors( int numberOfErrors )
59      {
60          this.numberOfErrors = numberOfErrors;
61      }
62  
63      public int getNumberOfFailures()
64      {
65          return numberOfFailures;
66      }
67  
68      public void setNumberOfFailures( int numberOfFailures )
69      {
70          this.numberOfFailures = numberOfFailures;
71      }
72  
73      public int getNumberOfSkipped()
74      {
75          return numberOfSkipped;
76      }
77  
78      public void setNumberOfSkipped( int numberOfSkipped )
79      {
80          this.numberOfSkipped = numberOfSkipped;
81      }
82  
83      public int getNumberOfTests()
84      {
85          if ( numberOfTests != null )
86          {
87              return numberOfTests;
88          }
89          if ( testCases != null )
90          {
91              return testCases.size();
92          }
93          return 0;
94      }
95  
96      public void setNumberOfTests( int numberOfTests )
97      {
98          this.numberOfTests = numberOfTests;
99      }
100 
101     public String getName()
102     {
103         return name;
104     }
105 
106     public void setName( String name )
107     {
108         this.name = name;
109     }
110 
111     public String getFullClassName()
112     {
113         return fullClassName;
114     }
115 
116     public void setFullClassName( String fullClassName )
117     {
118         this.fullClassName = fullClassName;
119         int lastDotPosition = fullClassName.lastIndexOf( "." );
120 
121         name = fullClassName.substring( lastDotPosition + 1, fullClassName.length() );
122 
123         if ( lastDotPosition < 0 )
124         {
125             /* no package name */
126             packageName = "";
127         }
128         else
129         {
130             packageName = fullClassName.substring( 0, lastDotPosition );
131         }
132     }
133 
134     public String getPackageName()
135     {
136         return packageName;
137     }
138 
139     public void setPackageName( String packageName )
140     {
141         this.packageName = packageName;
142     }
143 
144     public float getTimeElapsed()
145     {
146         return this.timeElapsed;
147     }
148 
149     public void setTimeElapsed( float timeElapsed )
150     {
151         this.timeElapsed = timeElapsed;
152     }
153 
154     public void setTestCases( List<ReportTestCase> testCases )
155     {
156         this.testCases = testCases;
157     }
158 
159     /**
160      * {@inheritDoc}
161      */
162     public String toString()
163     {
164         return fullClassName + " [" + getNumberOfTests() + "/" + getNumberOfFailures() + "/" + getNumberOfErrors() + "/"
165             + getNumberOfSkipped() + "]";
166     }
167 }