Browse Source

Unittest: colored traveloption Strandmap

remotes/origin/map
Tanja Herche 2 years ago
parent
commit
35d77a5e5d
  1. 16
      src/main/java/org/bitbiome/commands/MapCommand.java
  2. 26
      src/test/java/org/bitbiome/commands/MapCommandTest.java

16
src/main/java/org/bitbiome/commands/MapCommand.java

@ -30,6 +30,22 @@ public class MapCommand implements CommandAPI{
.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_BLUE + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\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_BLUE + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n")
.append("| | | |\n") .append("| | | |\n")
.append("|________________________________|________________________________|________________________________|\n"); .append("|________________________________|________________________________|________________________________|\n");
} else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Strand")) {
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_BRIGHT_BLACK + 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 { } else {
outputMessage outputMessage
.append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET) .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET)

26
src/test/java/org/bitbiome/commands/MapCommandTest.java

@ -36,6 +36,32 @@ public class MapCommandTest {
.append("|________________________________|________________________________|________________________________|\n"); .append("|________________________________|________________________________|________________________________|\n");
assertEquals(outputMessage.toString(), mapMessage);
}
@Test
public void testStrandMapCommand() {
Player Test = new Player("name");
TravelEngine outputtest = new TravelEngine(Test);
Location Strand = outputtest.getLocationByName("Strand");
outputtest.travelTo(Strand);
String mapMessage = MapCommand.getMapMessage(outputtest);
StringBuilder outputMessage = new StringBuilder();
outputMessage
.append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Strand" + "\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_BRIGHT_BLACK + "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); assertEquals(outputMessage.toString(), mapMessage);
} }
@Test @Test

Loading…
Cancel
Save