### Question:
ReplicatedLockTokenStateMachine implements StateMachine<ReplicatedLockTokenRequest> { public synchronized ReplicatedLockTokenRequest currentToken() { return state().get(); } ReplicatedLockTokenStateMachine( StateStorage<ReplicatedLockTokenState> storage ); @Override synchronized void applyCommand( ReplicatedLockTokenRequest tokenRequest, long commandIndex,
            Consumer<Result> callback ); @Override synchronized void flush(); @Override long lastAppliedIndex(); synchronized ReplicatedLockTokenState snapshot(); synchronized void installSnapshot( ReplicatedLockTokenState snapshot ); synchronized ReplicatedLockTokenRequest currentToken();  }### Answer:
@Test public void shouldStartWithInvalidTokenId() { ReplicatedLockTokenStateMachine stateMachine = new ReplicatedLockTokenStateMachine( new InMemoryStateStorage<>( new ReplicatedLockTokenState() ) ); int initialTokenId = stateMachine.currentToken().id(); assertEquals( initialTokenId, LockToken.INVALID_LOCK_TOKEN_ID ); }
@Test public void shouldSetInitialPendingRequestToInitialState() { @SuppressWarnings( "unchecked" ) StateStorage<ReplicatedLockTokenState> storage = mock( StateStorage.class ); MemberId initialHoldingCoreMember = member( 0 ); ReplicatedLockTokenState initialState = new ReplicatedLockTokenState( 123, new ReplicatedLockTokenRequest( initialHoldingCoreMember, 3 ) ); when( storage.getInitialState() ).thenReturn( initialState ); ReplicatedLockTokenStateMachine stateMachine = new ReplicatedLockTokenStateMachine( storage ); LockToken initialToken = stateMachine.currentToken(); assertEquals( initialState.get().owner(), initialToken.owner() ); assertEquals( initialState.get().id(), initialToken.id() ); }