1 | |
package org.apache.maven.plugins.surefire.report; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import java.util.ArrayList; |
23 | |
import java.util.List; |
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | 27 | public class ReportTestSuite |
29 | |
{ |
30 | 27 | 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 | 44 | return this.testCases; |
51 | |
} |
52 | |
|
53 | |
public int getNumberOfErrors() |
54 | |
{ |
55 | 4 | return numberOfErrors; |
56 | |
} |
57 | |
|
58 | |
public void setNumberOfErrors( int numberOfErrors ) |
59 | |
{ |
60 | 4 | this.numberOfErrors = numberOfErrors; |
61 | 4 | } |
62 | |
|
63 | |
public int getNumberOfFailures() |
64 | |
{ |
65 | 16 | return numberOfFailures; |
66 | |
} |
67 | |
|
68 | |
public void setNumberOfFailures( int numberOfFailures ) |
69 | |
{ |
70 | 16 | this.numberOfFailures = numberOfFailures; |
71 | 16 | } |
72 | |
|
73 | |
public int getNumberOfSkipped() |
74 | |
{ |
75 | 3 | 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 | 5 | if ( numberOfTests != null ) |
86 | |
{ |
87 | 3 | return numberOfTests; |
88 | |
} |
89 | 2 | if ( testCases != null ) |
90 | |
{ |
91 | 2 | return testCases.size(); |
92 | |
} |
93 | 0 | return 0; |
94 | |
} |
95 | |
|
96 | |
public void setNumberOfTests( int numberOfTests ) |
97 | |
{ |
98 | 3 | this.numberOfTests = numberOfTests; |
99 | 3 | } |
100 | |
|
101 | |
public String getName() |
102 | |
{ |
103 | 50 | 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 | 77 | return fullClassName; |
114 | |
} |
115 | |
|
116 | |
public void setFullClassName( String fullClassName ) |
117 | |
{ |
118 | 12 | this.fullClassName = fullClassName; |
119 | 12 | int lastDotPosition = fullClassName.lastIndexOf( "." ); |
120 | |
|
121 | 12 | name = fullClassName.substring( lastDotPosition + 1, fullClassName.length() ); |
122 | |
|
123 | 12 | if ( lastDotPosition < 0 ) |
124 | |
{ |
125 | |
|
126 | 2 | packageName = ""; |
127 | |
} |
128 | |
else |
129 | |
{ |
130 | 10 | packageName = fullClassName.substring( 0, lastDotPosition ); |
131 | |
} |
132 | 12 | } |
133 | |
|
134 | |
public String getPackageName() |
135 | |
{ |
136 | 16 | 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 | 5 | return this.timeElapsed; |
147 | |
} |
148 | |
|
149 | |
public void setTimeElapsed( float timeElapsed ) |
150 | |
{ |
151 | 16 | this.timeElapsed = timeElapsed; |
152 | 16 | } |
153 | |
|
154 | |
public void setTestCases( List<ReportTestCase> testCases ) |
155 | |
{ |
156 | 3 | this.testCases = testCases; |
157 | 3 | } |
158 | |
|
159 | |
|
160 | |
|
161 | |
|
162 | |
public String toString() |
163 | |
{ |
164 | 0 | return fullClassName + " [" + getNumberOfTests() + "/" + getNumberOfFailures() + "/" + getNumberOfErrors() + "/" |
165 | |
+ getNumberOfSkipped() + "]"; |
166 | |
} |
167 | |
} |