### Question:
Invocation { public void proceed() throws Throwable { if (proceeded) { throw new IllegalStateException("This invocation has already proceeded"); } proceeded = true; try { result = method.invoke(target, args); } catch (InvocationTargetException e) { this.throwable = e.getCause(); } } Invocation(Object target, Method method); void proceed(); Object target(); Method method(); Object[] args(); Invocation args(Object[] args); Object result(); Invocation result(Object result); Throwable throwable(); Invocation throwable(Throwable throwable); boolean proceeded();  }### Answer:
@Test public void testProceed() throws Throwable { Invocation invocation = new Invocation(new Target1(), Target1.class.getMethod("method1", String.class)); invocation.args(new Object[] {"hello"}); invocation.proceed(); assertThat(invocation.result(), is("hello")); assertTrue(invocation.proceeded()); invocation = new Invocation(new Target1(), Target1.class.getMethod("method2", Exception.class)); invocation.args(new Object[] {new RuntimeException("goodbye")}); invocation.proceed(); assertThat(invocation.throwable(), instanceOf(RuntimeException.class)); assertThat(invocation.throwable().getMessage(), is("goodbye")); assertNull(invocation.result()); try { invocation.proceed(); fail(); } catch (IllegalStateException e) { assertThat(e.getMessage(), is("This invocation has already proceeded")); } }