@Test
public void shouldApplyLabelTokenCommandToTheStoreInRecovery() throws Exception
{
final BatchTransactionApplier applier = newApplier( true );
final LabelTokenRecord before = new LabelTokenRecord( 42 );
final LabelTokenRecord after = new LabelTokenRecord( 42 );
after.setInUse( true );
after.setNameId( 323 );
final Command.LabelTokenCommand command =
new Command.LabelTokenCommand( before, after );
final NamedToken token = new NamedToken( "token", 21 );
when( labelTokenStore.getToken( (int) command.getKey() ) ).thenReturn( token );
boolean result = apply( applier, command::handle, transactionToApply );
assertFalse( result );
verify( labelTokenStore, times( 1 ) ).setHighestPossibleIdInUse( after.getId() );
verify( labelTokenStore, times( 1 ) ).updateRecord( after );
verify( cacheAccess, times( 1 ) ).addLabelToken( token );
}