From ac09973e1f3b332e8b57eb1b98c6031c418d95af Mon Sep 17 00:00:00 2001 From: fdai7430 Date: Sat, 28 Jan 2023 17:06:28 +0100 Subject: [PATCH] Added test for testUseItem() (Player version) --- .../java/org/bitbiome/commands/UseCommandTest.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/java/org/bitbiome/commands/UseCommandTest.java b/src/test/java/org/bitbiome/commands/UseCommandTest.java index b846d9e..04fdf71 100644 --- a/src/test/java/org/bitbiome/commands/UseCommandTest.java +++ b/src/test/java/org/bitbiome/commands/UseCommandTest.java @@ -26,6 +26,17 @@ public class UseCommandTest { assertEquals(0, player.getLocation().getMobList().size()); } + @Test + public void testUseItemPlayer() { + UseCommand com = new UseCommand(); + Player player = new Player("test"); + Item sword = new Item("Sword", true, 10); + assertEquals("You used Sword on yourself", com.useItem(sword, player)); + assertEquals(90, player.getHp()); + Item sword2 = new Item("Heiliges Schwert der Engel", true, 1000); + assertEquals("You used Heiliges Schwert der Engel on yourself and died.", com.useItem(sword2, player)); + } + @Test public void testGetUseMessage() { UseCommand com = new UseCommand();