// Handle Connection.commit()
doAnswer(new Answer() {
public Object answer(InvocationOnMock invocation) throws Throwable {
EventRecorder eventRecorder = EventRecorder.getEventRecorder(mockConnection);
eventRecorder.addEvent(new LocalCommitEvent(mockConnection, new Exception()));
return null;
}
}).doThrow(new SQLException("Transaction already commited")).when(mockConnection).commit();
// Handle Connection.rollback()