@Test
public void shouldReadNoKeyIdAsMinusOne() throws Exception
{
InMemoryClosableChannel channel = new InMemoryClosableChannel();
IndexDefineCommand definitions = new IndexDefineCommand();
int indexNameId = 10;
definitions.init(
ObjectIntHashMap.newWithKeysValues( "myindex", indexNameId ),
new ObjectIntHashMap<>() );
definitions.serialize( channel );
RemoveCommand removeCommand = new IndexCommand.RemoveCommand();
removeCommand.init( indexNameId, IndexEntityType.Node.id(), 1234, -1, null );
removeCommand.serialize( channel );
PhysicalLogCommandReaderV2_2_4 reader = new PhysicalLogCommandReaderV2_2_4();
assertTrue( reader.read( channel ) instanceof IndexDefineCommand );
RemoveCommand readRemoveCommand = (RemoveCommand) reader.read( channel );
assertEquals( removeCommand.getIndexNameId(), readRemoveCommand.getIndexNameId() );
assertEquals( removeCommand.getEntityType(), readRemoveCommand.getEntityType() );
assertEquals( removeCommand.getEntityId(), readRemoveCommand.getEntityId() );
assertEquals( removeCommand.getKeyId(), readRemoveCommand.getKeyId() );
assertNull( removeCommand.getValue() );
}
}