@Test
public void testSubmitWithAbortException() throws Exception {

    doReturn(immediateTrueFluentFuture()).when(mockCohort1).canCommit();
    doReturn(Futures.immediateFailedFuture(new IllegalStateException("mock abort error")))
            .when(mockCohort1).abort();
    IllegalStateException cause = new IllegalStateException("mock canCommit error");
    doReturn(Futures.immediateFailedFuture(cause)).when(mockCohort2).canCommit();
    doReturn(immediateNullFluentFuture()).when(mockCohort2).abort();
    FluentFuture<? extends CommitInfo> future = coordinator.commit(
            transaction, Arrays.asList(mockCohort1, mockCohort2));
    assertFailure(future, cause, mockCohort1, mockCohort2);
}