### Question:
ReplicatedTransactionCommitProcess implements TransactionCommitProcess { @Override public long commit( final TransactionToApply tx, final CommitEvent commitEvent, TransactionApplicationMode mode ) throws TransactionFailureException { TransactionRepresentationReplicatedTransaction transaction = ReplicatedTransaction.from( tx.transactionRepresentation() ); Future<Object> futureTxId; try { futureTxId = replicator.replicate( transaction, true ); } catch ( ReplicationFailureException e ) { throw new TransactionFailureException( ReplicationFailure, e ); } try { return (long) futureTxId.get(); } catch ( ExecutionException e ) { if ( e.getCause() instanceof TransactionFailureException ) { throw (TransactionFailureException) e.getCause(); } throw new RuntimeException( e ); } catch ( InterruptedException e ) { throw new TransactionFailureException( "Interrupted while waiting for txId", e ); } } ReplicatedTransactionCommitProcess( Replicator replicator ); @Override long commit( final TransactionToApply tx,
                        final CommitEvent commitEvent,
                        TransactionApplicationMode mode );  }### Answer:
@Test public void shouldReplicateTransaction() throws Exception { CompletableFuture<Object> futureTxId = new CompletableFuture<>(); futureTxId.complete( 5L ); when( replicator.replicate( any( ReplicatedContent.class ), anyBoolean() ) ).thenReturn( futureTxId ); ReplicatedTransactionCommitProcess commitProcess = new ReplicatedTransactionCommitProcess( replicator ); long txId = commitProcess.commit( new TransactionToApply( tx ), CommitEvent.NULL, TransactionApplicationMode.EXTERNAL ); assertEquals( 5, txId ); }