@Test
public void testInterceptMethodInvocationWithExceptionThrown() throws Throwable {

    // GIVEN
    final JpaUnitException exception = new JpaUnitException("some reason");
    when(delegate.testMethod()).thenThrow(exception);
    final Object[] args = new Object[0];
    // WHEN
    try {
    	CucumberInterceptor.intercept(executor, delegate, method, args);
        fail("JpaUnitException expected");
    } catch (final JpaUnitException e) {
        assertThat(e, equalTo(exception));
    }
    // THEN
    final ArgumentCaptor<TestInvocation> beforeCaptor = ArgumentCaptor.forClass(TestInvocation.class);
    final ArgumentCaptor<TestInvocation> afterCaptor = ArgumentCaptor.forClass(TestInvocation.class);
    final InOrder inOrder = inOrder(executor, delegate);
    inOrder.verify(executor).processBefore(beforeCaptor.capture());
    inOrder.verify(delegate).testMethod();
    inOrder.verify(executor).processAfter(afterCaptor.capture());
    final TestInvocation invocation1 = beforeCaptor.getValue();
    final TestInvocation invocation2 = afterCaptor.getValue();
    assertThat(invocation1, equalTo(invocation2));
    assertThat(invocation1.getException().isPresent(), equalTo(Boolean.TRUE));
    assertThat(invocation1.getContext(), equalTo(context));
    assertThat(invocation1.getFeatureResolver().shouldCleanupAfter(), equalTo(Boolean.FALSE));
    assertThat(invocation1.getFeatureResolver().shouldCleanupBefore(), equalTo(Boolean.FALSE));
    assertThat(invocation1.getTestInstance().get(), equalTo(delegate));
    assertThat(invocation1.getTestMethod().get(), equalTo(method));
}