From 5aa9a17f3743e230c36ab4754deceaf6adff806e Mon Sep 17 00:00:00 2001 From: fdai7430 Date: Sat, 28 Jan 2023 17:04:10 +0100 Subject: [PATCH] Added test for testUseItem() (Mob version) --- .../java/org/bitbiome/commands/UseCommandTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/test/java/org/bitbiome/commands/UseCommandTest.java b/src/test/java/org/bitbiome/commands/UseCommandTest.java index 49c185d..b846d9e 100644 --- a/src/test/java/org/bitbiome/commands/UseCommandTest.java +++ b/src/test/java/org/bitbiome/commands/UseCommandTest.java @@ -13,6 +13,19 @@ public class UseCommandTest { 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 public void testGetUseMessage() { UseCommand com = new UseCommand();