1515 */
1616package pl .wavesoftware .eid .exceptions ;
1717
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 ;
2318import org .assertj .core .util .Lists ;
2419import org .assertj .core .util .Maps ;
2520import org .junit .Test ;
2621import org .junit .runner .RunWith ;
2722import org .junit .runners .Parameterized ;
2823import org .junit .runners .Parameterized .Parameters ;
2924
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+
3032/**
3133 *
3234 * @author Krzysztof Suszyński <krzysztof.suszynski@wavesoftware.pl>
@@ -47,7 +49,7 @@ private static Map<Class<? extends EidRuntimeException>, Class<? extends Runtime
4749 }
4850
4951 private static List <Object []> getArguments () {
50- Throwable cause = new InterruptedException ();
52+ Throwable cause = new InterruptedException ("A testing message" );
5153 String eid = "20150718:112954" ;
5254 String ref = "PL-981" ;
5355 Eid id = new Eid (eid );
@@ -148,10 +150,24 @@ public void testGetStandardJdkClass() {
148150 assertThat (jdkCls ).isEqualTo (jdkClass );
149151 }
150152
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+
151166 @ Test
152167 public void testConstruction () {
153168 // given
154169 EidRuntimeException exception = construct ();
170+
155171 // then
156172 assertThat (exception ).isNotNull ();
157173 assertThat (exception ).isExactlyInstanceOf (eidClass );
0 commit comments