diff --git a/src/main/java/org/bitbiome/commands/CommandListener.java b/src/main/java/org/bitbiome/commands/CommandListener.java index d59813c..7d03184 100644 --- a/src/main/java/org/bitbiome/commands/CommandListener.java +++ b/src/main/java/org/bitbiome/commands/CommandListener.java @@ -18,6 +18,7 @@ public class CommandListener { commands.put("quit", new QuitCommand()); commands.put("location", new LocationCommand()); commands.put("travel", new TravelCommand()); + commands.put("map", new MapCommand()); } public HashMap returnCommands() { diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java new file mode 100644 index 0000000..3b1620c --- /dev/null +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -0,0 +1,23 @@ +package org.bitbiome.commands; + +import org.bitbiome.classes.TravelEngine; + +import java.util.Scanner; + +public class MapCommand implements CommandAPI{ + + @Override + public void performCommand(Scanner scanner, boolean isRunning, String message, TravelEngine travelEngine) { + System.out.println(getMapMessage()); + } + public static String getMapMessage() { + StringBuilder outputMessage = new StringBuilder(); + outputMessage + .append("Map:\n") + .append("Wueste Gruendland Winterland\n\n") + .append("Strand Wald Berge\n\n"); + return outputMessage.toString(); + } + + +} diff --git a/src/test/java/org/bitbiome/commands/MapCommandTest.java b/src/test/java/org/bitbiome/commands/MapCommandTest.java new file mode 100644 index 0000000..def2566 --- /dev/null +++ b/src/test/java/org/bitbiome/commands/MapCommandTest.java @@ -0,0 +1,18 @@ +package org.bitbiome.commands; + +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class MapCommandTest { + @Test + public void testMapCommand() { + String mapMessage = MapCommand.getMapMessage(); + StringBuilder outputMessage = new StringBuilder(); + outputMessage + .append("Map:\n") + .append("Wueste Gruendland Winterland\n\n") + .append("Strand Wald Berge\n\n"); + assertEquals(outputMessage.toString(), mapMessage); + } +}