2121import org .junit .Test ;
2222import org .junit .rules .ExpectedException ;
2323
24- import javax .xml . bind . JAXBException ;
24+ import javax .naming . NamingException ;
2525import java .util .UnknownFormatConversionException ;
2626
2727import static org .hamcrest .CoreMatchers .containsString ;
3232 * @author Krzysztof Suszyński <krzysztof.suszynski@wavesoftware.pl>
3333 * @since 2015-10-07
3434 */
35- @ SuppressWarnings ("ConstantConditions" )
3635public class EidRuntimeExceptionTest {
3736
3837 @ Rule
@@ -42,19 +41,19 @@ public class EidRuntimeExceptionTest {
4241 public void testGetMessage () {
4342 // then
4443 thrown .expect (EidRuntimeException .class );
45- thrown .expectCause (CoreMatchers .<Throwable >instanceOf (JAXBException .class ));
44+ thrown .expectCause (CoreMatchers .<Throwable >instanceOf (NamingException .class ));
4645 thrown .expectCause (hasMessage (is ((String ) null )));
4746 thrown .expectMessage (containsString ("20151007:212217" ));
48- thrown .expectMessage (containsString ("javax.xml.bind.JAXBException\n - " +
49- "with linked exception:\n " +
50- "[java.util.UnknownFormatConversionException: " +
51- "Conversion = Invalid for unit test]" ));
47+ thrown .expectMessage (containsString (
48+ "javax.naming.NamingException [Root exception is java.util" +
49+ ".UnknownFormatConversionException: Conversion = Invalid for" +
50+ " unit test]"
51+ ));
5252
5353 // given
54- String message = null ;
5554 Throwable original = new UnknownFormatConversionException ("Invalid for unit test" );
56- JAXBException cause = new JAXBException ( message );
57- cause .setLinkedException (original );
55+ NamingException cause = new NamingException ( null );
56+ cause .setRootCause (original );
5857 throw new EidRuntimeException ("20151007:212217" , cause );
5958 }
6059
0 commit comments