From 7589c79f3cb39b9787b86c1ee39f4bca518ec0ae Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 14:49:44 +0100 Subject: [PATCH] Unittest: colored traveloption Gruenlandmap --- .../org/bitbiome/commands/MapCommand.java | 16 ++++++++++++ .../org/bitbiome/commands/MapCommandTest.java | 25 +++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index e9d5cde..14952ff 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -78,6 +78,22 @@ public class MapCommand implements CommandAPI{ .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); + } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Gruenland")) { + outputMessage + .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + "Zu den blau markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append(" __________________________________________________________________________________________________\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BLUE + locations.getJSONObject(5).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n"); + } else { outputMessage .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET) diff --git a/src/test/java/org/bitbiome/commands/MapCommandTest.java b/src/test/java/org/bitbiome/commands/MapCommandTest.java index 682197a..1eee876 100644 --- a/src/test/java/org/bitbiome/commands/MapCommandTest.java +++ b/src/test/java/org/bitbiome/commands/MapCommandTest.java @@ -114,6 +114,31 @@ public class MapCommandTest { .append("|________________________________|________________________________|________________________________|\n"); + assertEquals(outputMessage.toString(), mapMessage); + } + public void testGruenlandMapCommand() { + Player Test = new Player("name"); + TravelEngine outputtest = new TravelEngine(Test); + Location Gruenland = outputtest.getLocationByName("Gruenland"); + outputtest.travelTo(Gruenland); + String mapMessage = MapCommand.getMapMessage(outputtest); + StringBuilder outputMessage = new StringBuilder(); + outputMessage + .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Gruenland" + "\n" + "Zu den blau markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append(" __________________________________________________________________________________________________\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BLUE + "Wueste" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Gruenland" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Winterland" + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + "Strand" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Wald" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Berge" + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n"); + + assertEquals(outputMessage.toString(), mapMessage); } @Test