### Question:
TransactionHandleRegistry implements TransactionRegistry { @Override public long begin( TransactionHandle handle ) { long id = idGenerator.incrementAndGet(); if ( null == registry.putIfAbsent( id, new ActiveTransaction( handle ) ) ) { return id; } else { throw new IllegalStateException( "Attempt to begin transaction for id that was already registered" ); } } TransactionHandleRegistry( Clock clock, long timeoutMillis, LogProvider logProvider ); @Override long begin( TransactionHandle handle ); @Override long release( long id, TransactionHandle transactionHandle ); @Override TransactionHandle acquire( long id ); @Override void forget( long id ); @Override TransactionHandle terminate( long id ); @Override void rollbackAllSuspendedTransactions(); void rollbackSuspendedTransactionsIdleSince( final long oldestLastActiveTime );  }### Answer:
@Test public void shouldGenerateTransactionId() { AssertableLogProvider logProvider = new AssertableLogProvider(); TransactionHandleRegistry registry = new TransactionHandleRegistry( Clocks.fakeClock(), 0, logProvider ); TransactionHandle handle = mock( TransactionHandle.class ); long id1 = registry.begin( handle ); long id2 = registry.begin( handle ); assertNotEquals( id1, id2 ); logProvider.assertNoLoggingOccurred(); }