@Test public void invokingMethodQuietlyPropagatesExceptionRaisedByMethod() { thrown.expect(ReflectionException.class); thrown.expectMessage(NumberFormatException.class.getName()); invoke(findMethod(getClass(), "bar"), this); }
@Test public void invokingMethodQuietlyWrapsIllegalAccessException() throws Exception { Method method = ZeroArgIllegalAccessProblematic.class.getDeclaredMethod("foo"); thrown.expect(ReflectionException.class); thrown.expectMessage(IllegalAccessException.class.getName()); invoke(method, new ZeroArgIllegalAccessProblematic(0)); }
@Test public void invokingMethodQuietlyPropagatesOtherRuntimeExceptions() throws Exception { thrown.expect(NullPointerException.class); invoke(findMethod(getClass(), "bar"), null); }
@Test public void invokingMethodPropagatesIllegalArgumentException() { thrown.expect(IllegalArgumentException.class); invoke(findMethod(getClass(), "bar"), this, "baz"); }