From 340fb80cc6f52ccf234b0bbeb72ca5e828c1d385 Mon Sep 17 00:00:00 2001 From: Juliakn66 <117075450+Juliakn66@users.noreply.github.com> Date: Sat, 4 Feb 2023 14:13:14 +0100 Subject: [PATCH] unittest: added testGetItemsOutputWithItems() --- .../bitbiome/commands/LookaroundCommandTest.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/bitbiome/commands/LookaroundCommandTest.java b/src/test/java/org/bitbiome/commands/LookaroundCommandTest.java index b48690f..ac1a1d2 100644 --- a/src/test/java/org/bitbiome/commands/LookaroundCommandTest.java +++ b/src/test/java/org/bitbiome/commands/LookaroundCommandTest.java @@ -68,5 +68,17 @@ public class LookaroundCommandTest { assertTrue(mob.getName().equals("BigFoot") || mob.getName().equals("Yeti")); } } - + @Test + public void testGetItemsOutputWithItems() { + LookaroundCommand command = new LookaroundCommand(); + int randomNumberItems = 3; + StringBuilder outputMessage = new StringBuilder(); + ArrayList foundItems = new ArrayList(); + foundItems.add(new Item("Holz", true, 10, 1)); + foundItems.add(new Item("Stein", true, 10, 1)); + foundItems.add(new Item("Sand", false, 1, 1)); + command.getItemsOutput(randomNumberItems, outputMessage, foundItems); + String expectedOutput = "Huch, was liegt denn hier rum?\n- Holz\n- Stein\n- Sand\nSchnell, sammel es ein!\n"; + assertEquals(expectedOutput, outputMessage.toString()); + } }