@Test
public void testCommitWhenGlobalTxStarted() {

    // Setup
    when(mockBusinessGlobalTransactionService.retrieveGlobalTransaction(Optional.of(requestGlobalTransaction))).thenReturn(Optional.of(globalTransaction));
    when(globalTransaction.getStatus()).thenReturn(GlobalTransaction.GlobalTransactionStatus.STARTED);
    // Run the test
    businessGlobalTransactionManagerImplUnderTest.commit(pipeline);
    // Verify the results
    verify(globalTransaction).setStatus(same(GlobalTransaction.GlobalTransactionStatus.COMITTED));
    verify(mockGlobalTransactionRepository).save(same(globalTransaction));
    verify(pipeline).accept(any());
}