From 05a2fc6e78aa1de2b238794fc158e1883075c39e Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 14:42:43 +0100 Subject: [PATCH] Unittest: colored traveloption Wuestemap --- .../org/bitbiome/commands/MapCommand.java | 16 ++++++++++++ .../org/bitbiome/commands/MapCommandTest.java | 26 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index 0928764..e9d5cde 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -62,6 +62,22 @@ public class MapCommand implements CommandAPI{ .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); + } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wueste")) { + 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_BRIGHT_BLACK + locations.getJSONObject(5).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BLUE + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + 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 0b32598..682197a 100644 --- a/src/test/java/org/bitbiome/commands/MapCommandTest.java +++ b/src/test/java/org/bitbiome/commands/MapCommandTest.java @@ -88,6 +88,32 @@ public class MapCommandTest { .append("|________________________________|________________________________|________________________________|\n"); + assertEquals(outputMessage.toString(), mapMessage); + } + @Test + public void testWuesteMapCommand() { + Player Test = new Player("name"); + TravelEngine outputtest = new TravelEngine(Test); + Location Wueste = outputtest.getLocationByName("Wueste"); + outputtest.travelTo(Wueste); + String mapMessage = MapCommand.getMapMessage(outputtest); + StringBuilder outputMessage = new StringBuilder(); + outputMessage + .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Wueste" + "\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_BRIGHT_BLACK + "Wueste" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Gruenland" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Winterland" + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BLUE + "Strand" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Wald" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Berge" + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n"); + + assertEquals(outputMessage.toString(), mapMessage); } @Test