@Test
public void invoke_fails() throws Throwable {

  StatementInvocationHandler statementInvocationHandler =
      new StatementInvocationHandler(
                  mockRealStatement, TRACE_OPTIONS, mockTraceService, Optional.<String>absent());
  Exception expectedException = new SQLException();
  when(mockRealStatement.execute("some sql text")).thenThrow(expectedException);
  try {
    statementInvocationHandler.invoke(
            mockProxy,
            Statement.class.getDeclaredMethod("execute", String.class),
            new Object[]{"some sql text"});
  } catch (Exception actualException) {
    assertThat(actualException).isSameAs(expectedException);
  }
  InOrder inOrder = inOrder(mockTraceService, mockTraceSpan, mockRealStatement);
  inOrder.verify(mockTraceService).open("JDBC.Statement#execute");
  inOrder.verify(mockRealStatement).execute("some sql text");
  inOrder.verify(mockTraceSpan).close();
}