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