Code example for InvocationTargetException

0
        } 
    } 
 
    static class TestClassWithInvocationTargetException { 
        public String foo() throws Exception {
            throw new InvocationTargetException(new Exception());
        } 
    } 
 
 
    @Test
    public void should_return_the_result_of_the_invoked_method() throws NoSuchMethodException {
        TestClass testClass = new TestClass();
        Method foo = testClass.getClass().getMethod("foo");
 
        String result = (String) MethodInvoker.on(testClass).run(foo);
        assertThat(result, is("bar"));
    } 
 
    @Test(expected = IllegalArgumentException.class)
Connect your IDE to all the code out there  Get Codota for Java