From d704d962a834e3f2b7d576f63ef569cf4f132222 Mon Sep 17 00:00:00 2001 From: Juliakn66 <117075450+Juliakn66@users.noreply.github.com> Date: Sat, 4 Feb 2023 14:16:42 +0100 Subject: [PATCH] unittest: added testGetMobsOutputWithMobs() --- .../bitbiome/commands/LookaroundCommandTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/java/org/bitbiome/commands/LookaroundCommandTest.java b/src/test/java/org/bitbiome/commands/LookaroundCommandTest.java index e109a94..cc0fa77 100644 --- a/src/test/java/org/bitbiome/commands/LookaroundCommandTest.java +++ b/src/test/java/org/bitbiome/commands/LookaroundCommandTest.java @@ -91,4 +91,19 @@ public class LookaroundCommandTest { String expectedOutput = "Hier gibt es leider nichts für dich zum Einsammeln.\n"; assertEquals(expectedOutput, outputMessage.toString()); } + @Test + public void testGetMobsOutputWithMobs() { + LookaroundCommand command = new LookaroundCommand(); + int randomNumberMobs = 2; + int randomNumberItems = 0; + StringBuilder outputMessage = new StringBuilder(); + ArrayList foundMobs = new ArrayList<>(); + foundMobs.add(new Mob("Big Foot", true, 50, 15)); + foundMobs.add(new Mob("Yeti", false, 70, 30)); + + command.getMobsOutput( randomNumberItems,randomNumberMobs, outputMessage, foundMobs); + + String expectedOutput = "Achtung, hier lauern Gefahren! Sei auf der Hut vor: \n- Big Foot\n- Yeti\n"; + assertEquals(expectedOutput, outputMessage.toString()); + } }