Write two classes which represent the Command pattern, CommandMove and CommandPutItem.
These classes should also support undo. They should implement the entity movement on the 2D and item putting. The x-axis on the map goes from left to right, the y-axis goes from bottom to top.
The inventory of the entity has getInventoryLength() slots starting from 0, and each slot can contain only one item. The entity should put an item into a slot with least possible index (slots with nothing inside is null). If all slots of an entity are filled with some item, then entity should not place this item in its inventory.
To undo, you should revert the changes made to the entity, so the coordinates and the inventory of the entity before execute() and after undo() should be the same.
Note that you need to implement CommandMove and CommandPutItem classes only. You are free to add any new fields and use them. No need to implement Movable and Storable interfaces and set entity fields of command classes. The testing system does it for you.
Command moveCommand = new CommandMove(); // Testing system creates instance of CommandMove
moveCommand.entity = new TestMovable(); // and initializes entity field by testing entity
// then tested methods are invoked
moveCommand.execute();
moveCommand.undo();
The same logic works for testing CommandPutItem class.