@Test public void invokingZeroArgConstructorQuietlyWrapsIllegalAccessException() { thrown.expect(ReflectionException.class); thrown.expectMessage(IllegalAccessException.class.getName()); instantiate(ZeroArgIllegalAccessProblematic.class); }
@Test public void invokingNonZeroArgConstructorQuietlyPropagatesIllegalArgumentException() throws Exception { thrown.expect(IllegalArgumentException.class); instantiate(Integer.class.getDeclaredConstructor(int.class), "2"); }
@Test public void invokingNonZeroArgConstructorWrapsExceptionsRaisedByConstructor() throws Exception { thrown.expect(ReflectionException.class); thrown.expectMessage(IndexOutOfBoundsException.class.getName()); instantiate(InvocationTargetProblematic.class.getConstructor(int.class), 2); }
@Test public void invokingNonZeroArgConstructorQuietlyWrapsIllegalAccessException() throws Exception { thrown.expect(ReflectionException.class); thrown.expectMessage(IllegalAccessException.class.getName()); instantiate(MultiArgIllegalAccessProblematic.class.getDeclaredConstructor(int.class), 2); }
@Test public void invokingZeroArgConstructorPropagatesExceptionsRaisedByConstructor() { thrown.expect(IllegalStateException.class); instantiate(InvocationTargetProblematic.class); }