15
15
*/
16
16
package pl .wavesoftware .eid .exceptions ;
17
17
18
- import java .lang .reflect .Constructor ;
19
- import java .lang .reflect .InvocationTargetException ;
20
- import java .util .List ;
21
- import java .util .Map ;
22
- import static org .assertj .core .api .Assertions .assertThat ;
23
18
import org .assertj .core .util .Lists ;
24
19
import org .assertj .core .util .Maps ;
25
20
import org .junit .Test ;
26
21
import org .junit .runner .RunWith ;
27
22
import org .junit .runners .Parameterized ;
28
23
import org .junit .runners .Parameterized .Parameters ;
29
24
25
+ import java .lang .reflect .Constructor ;
26
+ import java .lang .reflect .InvocationTargetException ;
27
+ import java .util .List ;
28
+ import java .util .Map ;
29
+
30
+ import static org .assertj .core .api .Assertions .assertThat ;
31
+
30
32
/**
31
33
*
32
34
* @author Krzysztof Suszyński <[email protected] >
@@ -47,7 +49,7 @@ private static Map<Class<? extends EidRuntimeException>, Class<? extends Runtime
47
49
}
48
50
49
51
private static List <Object []> getArguments () {
50
- Throwable cause = new InterruptedException ();
52
+ Throwable cause = new InterruptedException ("A testing message" );
51
53
String eid = "20150718:112954" ;
52
54
String ref = "PL-981" ;
53
55
Eid id = new Eid (eid );
@@ -148,10 +150,24 @@ public void testGetStandardJdkClass() {
148
150
assertThat (jdkCls ).isEqualTo (jdkClass );
149
151
}
150
152
153
+ @ Test
154
+ public void testMessage () {
155
+ // given
156
+ EidRuntimeException exception = construct ();
157
+ boolean hasCause = exception .getCause () != null ;
158
+
159
+ // then
160
+ assertThat (exception ).hasMessageContaining ("20150718:112954" );
161
+ if (hasCause ) {
162
+ assertThat (exception ).hasMessageContaining ("A testing message" );
163
+ }
164
+ }
165
+
151
166
@ Test
152
167
public void testConstruction () {
153
168
// given
154
169
EidRuntimeException exception = construct ();
170
+
155
171
// then
156
172
assertThat (exception ).isNotNull ();
157
173
assertThat (exception ).isExactlyInstanceOf (eidClass );
0 commit comments