Browse Source

Added test for testUseItem() (Mob version)

remotes/origin/fight-engine
fdai7430 2 years ago
parent
commit
5aa9a17f37
  1. 13
      src/test/java/org/bitbiome/commands/UseCommandTest.java

13
src/test/java/org/bitbiome/commands/UseCommandTest.java

@ -13,6 +13,19 @@ public class UseCommandTest {
testGetUseMessage(); testGetUseMessage();
} }
@Test
public void testUseItemMob() {
UseCommand com = new UseCommand();
Player player = new Player("test");
Mob mob = new Mob("Wolf", false, 11, 10);
player.getLocation().getMobList().add(mob);
Item sword = new Item("Sword", true, 10);
assertEquals("You used Sword on Wolf", com.useItem(sword, mob, player.getLocation()));
assertEquals(1, player.getLocation().getMobList().size());
assertEquals("You killed Wolf with Sword", com.useItem(sword, mob, player.getLocation()));
assertEquals(0, player.getLocation().getMobList().size());
}
@Test @Test
public void testGetUseMessage() { public void testGetUseMessage() {
UseCommand com = new UseCommand(); UseCommand com = new UseCommand();

Loading…
Cancel
Save