1 | |
package org.apache.maven.surefire.report; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
public class SimpleReportEntry |
26 | |
implements ReportEntry |
27 | |
{ |
28 | |
private final String source; |
29 | |
|
30 | |
private final String name; |
31 | |
|
32 | |
private final StackTraceWriter stackTraceWriter; |
33 | |
|
34 | |
private final Integer elapsed; |
35 | |
|
36 | |
public SimpleReportEntry( String source, String name ) |
37 | |
{ |
38 | 0 | this( source, name, null, null ); |
39 | 0 | } |
40 | |
|
41 | |
public SimpleReportEntry( String source, String name, StackTraceWriter stackTraceWriter ) |
42 | |
{ |
43 | 0 | this( source, name, stackTraceWriter, null ); |
44 | 0 | } |
45 | |
|
46 | |
public SimpleReportEntry( String source, String name, Integer elapsed ) |
47 | |
{ |
48 | 0 | this( source, name, null, elapsed ); |
49 | 0 | } |
50 | |
|
51 | |
protected SimpleReportEntry( String name ) |
52 | 0 | { |
53 | 0 | this.name = name; |
54 | 0 | this.stackTraceWriter = null; |
55 | 0 | this.elapsed = null; |
56 | 0 | this.source = null; |
57 | 0 | } |
58 | |
|
59 | |
|
60 | |
public SimpleReportEntry( String source, String name, StackTraceWriter stackTraceWriter, Integer elapsed ) |
61 | 0 | { |
62 | 0 | if ( source == null ) |
63 | |
{ |
64 | 0 | throw new NullPointerException( "source is null" ); |
65 | |
} |
66 | 0 | if ( name == null ) |
67 | |
{ |
68 | 0 | throw new NullPointerException( "name is null" ); |
69 | |
} |
70 | |
|
71 | 0 | this.source = source; |
72 | |
|
73 | 0 | this.name = name; |
74 | |
|
75 | 0 | this.stackTraceWriter = stackTraceWriter; |
76 | |
|
77 | 0 | this.elapsed = elapsed; |
78 | 0 | } |
79 | |
|
80 | |
|
81 | |
public String getSourceName() |
82 | |
{ |
83 | 0 | return source; |
84 | |
} |
85 | |
|
86 | |
public String getName() |
87 | |
{ |
88 | 0 | return name; |
89 | |
} |
90 | |
|
91 | |
public String getGroup() |
92 | |
{ |
93 | 0 | return null; |
94 | |
} |
95 | |
|
96 | |
public StackTraceWriter getStackTraceWriter() |
97 | |
{ |
98 | 0 | return stackTraceWriter; |
99 | |
} |
100 | |
|
101 | |
public Integer getElapsed() |
102 | |
{ |
103 | 0 | return elapsed; |
104 | |
} |
105 | |
|
106 | |
public String toString() |
107 | |
{ |
108 | 0 | return "ReportEntry{" + "source='" + source + '\'' + ", name='" + name + '\'' + ", stackTraceWriter=" |
109 | |
+ stackTraceWriter + ", elapsed=" + elapsed + '}'; |
110 | |
} |
111 | |
|
112 | |
|
113 | |
|
114 | |
|
115 | |
|
116 | |
public boolean equals( Object o ) |
117 | |
{ |
118 | 0 | if ( this == o ) |
119 | |
{ |
120 | 0 | return true; |
121 | |
} |
122 | 0 | if ( o == null || getClass() != o.getClass() ) |
123 | |
{ |
124 | 0 | return false; |
125 | |
} |
126 | |
|
127 | 0 | SimpleReportEntry that = (SimpleReportEntry) o; |
128 | |
|
129 | 0 | if ( elapsed != null ? !elapsed.equals( that.elapsed ) : that.elapsed != null ) |
130 | |
{ |
131 | 0 | return false; |
132 | |
} |
133 | 0 | if ( name != null ? !name.equals( that.name ) : that.name != null ) |
134 | |
{ |
135 | 0 | return false; |
136 | |
} |
137 | 0 | if ( source != null ? !source.equals( that.source ) : that.source != null ) |
138 | |
{ |
139 | 0 | return false; |
140 | |
} |
141 | 0 | if ( stackTraceWriter != null |
142 | |
? !stackTraceWriter.equals( that.stackTraceWriter ) |
143 | |
: that.stackTraceWriter != null ) |
144 | |
{ |
145 | 0 | return false; |
146 | |
} |
147 | |
|
148 | 0 | return true; |
149 | |
} |
150 | |
|
151 | |
public int hashCode() |
152 | |
{ |
153 | 0 | int result = source != null ? source.hashCode() : 0; |
154 | 0 | result = 31 * result + ( name != null ? name.hashCode() : 0 ); |
155 | 0 | result = 31 * result + ( stackTraceWriter != null ? stackTraceWriter.hashCode() : 0 ); |
156 | 0 | result = 31 * result + ( elapsed != null ? elapsed.hashCode() : 0 ); |
157 | 0 | return result; |
158 | |
} |
159 | |
|
160 | |
|
161 | |
} |