@Test public void shouldCreateANewExceptionUsingAnEmptyConstructor() throws Exception { System.out.println( "public static <T extends Exception> T newException(Class<T> clazz, Object... parameters)"); IOException exception = ReflectionHelper.newException(IOException.class); assertThat("IOException is not null", exception, notNullValue()); assertThat("MessageText is not null", exception.getMessage(), nullValue()); System.out.println(exception); }
@Test public void shouldCreateANewExceptionUsingAStringParameter() throws Exception { System.out.println( "public static <T extends Exception> T newException(Class<T> clazz, Object... parameters)"); IOException exception = ReflectionHelper.newException(IOException.class, "AnyMessageForOurIOException"); assertThat("IOException is not null", exception, notNullValue()); assertThat("MessageText", exception.getMessage(), equalTo("AnyMessageForOurIOException")); System.out.println(exception); }