@Test
public void invoke_commit_fails() throws Throwable {

  Exception expectedException = new SQLException();
  doThrow(expectedException).when(mockRealConnection).commit();
  try {
    connectionInvocationHandler.invoke(
            mockProxy, Connection.class.getDeclaredMethod("commit"), new Object[0]);
    fail("expected SQLException");
  } catch (Exception actualException) {
    assertThat(actualException).isSameAs(expectedException);
  }
  verify(mockRealConnection).commit();
}