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 this( source, name, null, null );
39 }
40
41 public SimpleReportEntry( String source, String name, StackTraceWriter stackTraceWriter )
42 {
43 this( source, name, stackTraceWriter, null );
44 }
45
46 public SimpleReportEntry( String source, String name, Integer elapsed )
47 {
48 this( source, name, null, elapsed );
49 }
50
51 protected SimpleReportEntry( String name )
52 {
53 this.name = name;
54 this.stackTraceWriter = null;
55 this.elapsed = null;
56 this.source = null;
57 }
58
59
60 public SimpleReportEntry( String source, String name, StackTraceWriter stackTraceWriter, Integer elapsed )
61 {
62 if ( source == null )
63 {
64 throw new NullPointerException( "source is null" );
65 }
66 if ( name == null )
67 {
68 throw new NullPointerException( "name is null" );
69 }
70
71 this.source = source;
72
73 this.name = name;
74
75 this.stackTraceWriter = stackTraceWriter;
76
77 this.elapsed = elapsed;
78 }
79
80
81 public String getSourceName()
82 {
83 return source;
84 }
85
86 public String getName()
87 {
88 return name;
89 }
90
91 public String getGroup()
92 {
93 return null;
94 }
95
96 public StackTraceWriter getStackTraceWriter()
97 {
98 return stackTraceWriter;
99 }
100
101 public Integer getElapsed()
102 {
103 return elapsed;
104 }
105
106 public String toString()
107 {
108 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 if ( this == o )
119 {
120 return true;
121 }
122 if ( o == null || getClass() != o.getClass() )
123 {
124 return false;
125 }
126
127 SimpleReportEntry that = (SimpleReportEntry) o;
128
129 if ( elapsed != null ? !elapsed.equals( that.elapsed ) : that.elapsed != null )
130 {
131 return false;
132 }
133 if ( name != null ? !name.equals( that.name ) : that.name != null )
134 {
135 return false;
136 }
137 if ( source != null ? !source.equals( that.source ) : that.source != null )
138 {
139 return false;
140 }
141 if ( stackTraceWriter != null
142 ? !stackTraceWriter.equals( that.stackTraceWriter )
143 : that.stackTraceWriter != null )
144 {
145 return false;
146 }
147
148 return true;
149 }
150
151 public int hashCode()
152 {
153 int result = source != null ? source.hashCode() : 0;
154 result = 31 * result + ( name != null ? name.hashCode() : 0 );
155 result = 31 * result + ( stackTraceWriter != null ? stackTraceWriter.hashCode() : 0 );
156 result = 31 * result + ( elapsed != null ? elapsed.hashCode() : 0 );
157 return result;
158 }
159
160
161 }