### Question:
SlaveTransactionCommitProcess implements TransactionCommitProcess { @Override public long commit( TransactionToApply batch, CommitEvent commitEvent, TransactionApplicationMode mode ) throws TransactionFailureException { if ( batch.next() != null ) { throw new IllegalArgumentException( "Only supports single-commit on slave --> master" ); } try { TransactionRepresentation representation = batch.transactionRepresentation(); RequestContext context = requestContextFactory.newRequestContext( representation.getLockSessionId() ); try ( Response<Long> response = master.commit( context, representation ) ) { return response.response(); } } catch ( ComException e ) { throw new TransientTransactionFailureException( "Cannot commit this transaction on the master. " + "The master is either down, or we have network connectivity problems.", e ); } } SlaveTransactionCommitProcess( Master master, RequestContextFactory requestContextFactory ); @Override long commit( TransactionToApply batch, CommitEvent commitEvent,
                        TransactionApplicationMode mode );  }### Answer:
@Test public void shouldForwardLockIdentifierToMaster() throws Exception { when( master.commit( requestContext, tx ) ).thenReturn( response ); commitProcess.commit( new TransactionToApply( tx ), CommitEvent.NULL, TransactionApplicationMode.INTERNAL ); assertThat( lastSeenEventIdentifier.get(), is( 1337 ) ); }
@Test( expected = TransientTransactionFailureException.class ) public void mustTranslateComExceptionsToTransientTransactionFailures() throws Exception { when( master.commit( requestContext, tx ) ).thenThrow( new ComException() ); commitProcess.commit( new TransactionToApply( tx ), CommitEvent.NULL, TransactionApplicationMode.INTERNAL ); }