Test1: testCheckDeferredHeuristicRollbackSecondResourceFails

Here you enlist 2 resources the first one commits ok but the second one throws XA_HEURRB ie some resources committed and other ones did not so you have a heuristic mixed exception. So catch that in your test and then do your assertion.

Test2: testCheckDeferredHeuristicRollbackFirstResourceFails
Hhere the first resource throws HeuristicRollback so the txn engine knows it can abort the second participant. If you want to see the exception in your deferred exception list try adding a third resource and have it commit first successfully. This way the txn engine cannot abort the transaction since that would produce a heuristic.

If you want to capture the exception in the final rollback exception passed to the user you will need to add some tweaks to your implementation since in this case the failed/heurisic lists are cleared since the engine knows all participants have rolled back so there is nothing to recover.