From 8581b7ee640842e086f142522035e948348e1130 Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Fri, 25 Mar 2022 11:06:08 +0100 Subject: [PATCH] - updated javadoc - added playscenario to GameTest --- Klassendiagramm.drawio | 2 +- src/main/java/ch/zhaw/pm2/racetrack/Game.java | 1 - .../java/ch/zhaw/pm2/racetrack/Track.java | 1 - .../racetrack/strategy/DoNotMoveStrategy.java | 6 ++- .../racetrack/strategy/MoveListStrategy.java | 15 ++++++++ .../strategy/PathFinderMoveStrategy.java | 2 +- .../racetrack/strategy/UserMoveStrategy.java | 1 + .../java/ch/zhaw/pm2/racetrack/GameTest.java | 37 +++++++++++++------ 8 files changed, 49 insertions(+), 16 deletions(-) diff --git a/Klassendiagramm.drawio b/Klassendiagramm.drawio index 987ce13..4263a6f 100644 --- a/Klassendiagramm.drawio +++ b/Klassendiagramm.drawio @@ -1 +1 @@ -7V1Zd5vIEv41Pkd5UI4akJAetcSJ59qJJ3a2p3uw1JaYIFoDyLLy66ebTUAXAi00MjAPE9MCLf1V1/J1VfWVPF6+frS01eKOzLBxJXVmr1fy5EqSJLmj0n/YyNYbQYoieSNzS5/5Y7uBB/0P9gc7/uhan2E7dqNDiOHoq/jglJgmnjqxMc2yyCZ+2zMx4p+60uaYG3iYagY/+kOfOQt/tNdVdi98wvp8EXw06g28V5ZacLf/U+yFNiObyJD84UoeW4Q43l/L1zE22PQFE/PjZvvDuP3d+/jX3/a/2rfR/x4/f297b3Z9yCPhb7Cw6Rz91n9+P19/+q7883N1f/33pvNx+PRX23+k86IZa3/CPmpL7P9eZxvMor3Rl4Zm0qvRMzGdB/8VOgUjzdDnJv17Sr8btujAC7YcnQIw9F9wyIqOThe6MbvVtmTNfoHtaNPfwdVoQSz9D31bzaAvITpAX7YcX5akXuyOB/YkHe7QUQvb9J77YFpQOHSr2Y5/z5QYhray9Sf3C7Nblpo1180RcRyyDN6IrM0ZnvlXIc7uhWOR36HosOdzguGDxmYDv0Zk0QfnIyZL7Fhb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YyoltevB+z0DBs+vYhS6fd3bko+VEEKJpQEyvQoAp2C+0sTYZA+uZpNr2WQQMmdbCGhvQdYRSFTxfZzX771LEeKkTRC/C9pt/1kGBqSm5KLWxBYUKInU7DA6odGt0EvBhkwz5PtMaKhcTW/zud2xdznNpLCPrAJQB8COIn8osY4wYcLUpyEbcOHkCcfyrNGOJU1qBBGB5qlILw0fP54QehAo5yYogPMC6AQaLsteTqs0ECosiYlw4eO1oGxXuXI714CY5zHHstGGzGnAwjVbzNmm7STB/3eyZrVWxob8osfLtCAyQEUNMqJLQeloxr46DhKJbFhOnW5AnVZGAjp6rIIqa++3XXB6jJkcwtK2yM4XCEtkUCaKk1GQMqb4Jz4+4u0fgpphcQWIqi/oYB0pQMoTlNmDBDUCYAA9O0iLdTT26hAcWqmCHFdM7EycIWi2BCu5dmoYIuHoO7c25roRTV2lqNIO+cwoFfjTx2QSMFRF4nvsNJs87WY3kdsDy2dXYLBfVZ1laRy9y7FXi2mbRFbgQciszTllgMDxa2ZAiPQVfEMy0TPbp9wTploTUr/3BtT63QKb6fgPHryuKboHFkxVMycer/HiuLu5yXpzAfEUWh+1Knl1fjSNAw7eDtmCetPhoLIHf8B \ No newline at end of file diff --git a/src/main/java/ch/zhaw/pm2/racetrack/Game.java b/src/main/java/ch/zhaw/pm2/racetrack/Game.java index 7530831..80f8eb7 100644 --- a/src/main/java/ch/zhaw/pm2/racetrack/Game.java +++ b/src/main/java/ch/zhaw/pm2/racetrack/Game.java @@ -271,7 +271,6 @@ public class Game implements GameSpecification { currentCarIndex++; } } while (track.getCar(currentCarIndex).isCrashed()); - // TODO: evtl andere Kapselung } /** diff --git a/src/main/java/ch/zhaw/pm2/racetrack/Track.java b/src/main/java/ch/zhaw/pm2/racetrack/Track.java index 0be8237..f0f6fdb 100644 --- a/src/main/java/ch/zhaw/pm2/racetrack/Track.java +++ b/src/main/java/ch/zhaw/pm2/racetrack/Track.java @@ -123,7 +123,6 @@ public class Track implements TrackSpecification { } } - //TODO: THIS /** * Determines the finish line and saves it in a list, throws an Exception if none is found. diff --git a/src/main/java/ch/zhaw/pm2/racetrack/strategy/DoNotMoveStrategy.java b/src/main/java/ch/zhaw/pm2/racetrack/strategy/DoNotMoveStrategy.java index 62e15e3..ecfe157 100644 --- a/src/main/java/ch/zhaw/pm2/racetrack/strategy/DoNotMoveStrategy.java +++ b/src/main/java/ch/zhaw/pm2/racetrack/strategy/DoNotMoveStrategy.java @@ -5,10 +5,14 @@ import ch.zhaw.pm2.racetrack.PositionVector; import static ch.zhaw.pm2.racetrack.PositionVector.Direction; /** - * Do not accelerate in any direction. + * This Class represents the DoNotMoveStrategy. */ public class DoNotMoveStrategy implements MoveStrategy { + /** + * This method will be used to return the next Direction for the car. + * @return a NONE Direction + */ @Override public Direction nextMove() { return PositionVector.Direction.NONE; diff --git a/src/main/java/ch/zhaw/pm2/racetrack/strategy/MoveListStrategy.java b/src/main/java/ch/zhaw/pm2/racetrack/strategy/MoveListStrategy.java index 4966184..fdf14dd 100644 --- a/src/main/java/ch/zhaw/pm2/racetrack/strategy/MoveListStrategy.java +++ b/src/main/java/ch/zhaw/pm2/racetrack/strategy/MoveListStrategy.java @@ -10,6 +10,11 @@ import java.util.ArrayList; import java.util.List; import java.util.Scanner; +/** + * This Class represent the MoveListStrategy. The Directions returned by the + * nextMove() are written down in a List. + * + */ public class MoveListStrategy implements MoveStrategy { private final List moveList; @@ -21,6 +26,12 @@ public class MoveListStrategy implements MoveStrategy { readFile(new File(path)); } + /** + * This Method will read in a File and checks line by line if the file contains a valid direction. + * If so the direction will be added to the moveList. + * @param trackFile the file to read in the directions + * @throws FileNotFoundException if the file does not exist. + */ private void readFile(File trackFile) throws FileNotFoundException { Scanner scanner = new Scanner(new FileInputStream(trackFile), StandardCharsets.UTF_8); Direction[] directions = Direction.values(); @@ -35,6 +46,10 @@ public class MoveListStrategy implements MoveStrategy { } } + /** + * This method will be used to return the next Direction for the car. + * @return the next direction from the list. Returns null if the list is empty. + */ @Override public Direction nextMove() { pointer += 1; diff --git a/src/main/java/ch/zhaw/pm2/racetrack/strategy/PathFinderMoveStrategy.java b/src/main/java/ch/zhaw/pm2/racetrack/strategy/PathFinderMoveStrategy.java index 4148124..2b42b5b 100644 --- a/src/main/java/ch/zhaw/pm2/racetrack/strategy/PathFinderMoveStrategy.java +++ b/src/main/java/ch/zhaw/pm2/racetrack/strategy/PathFinderMoveStrategy.java @@ -141,7 +141,7 @@ public class PathFinderMoveStrategy implements MoveStrategy{ @Override - public PositionVector.Direction nextMove() { //TODO check for crash and recreate movelist if crash + public PositionVector.Direction nextMove() { pointer += 1; if (pointer < moveList.size()) { PositionVector.Direction direction = moveList.get(pointer); diff --git a/src/main/java/ch/zhaw/pm2/racetrack/strategy/UserMoveStrategy.java b/src/main/java/ch/zhaw/pm2/racetrack/strategy/UserMoveStrategy.java index d0755aa..a75b4fb 100644 --- a/src/main/java/ch/zhaw/pm2/racetrack/strategy/UserMoveStrategy.java +++ b/src/main/java/ch/zhaw/pm2/racetrack/strategy/UserMoveStrategy.java @@ -5,6 +5,7 @@ import ch.zhaw.pm2.racetrack.UserInterface; /** * Let the user decide the next move. + * Therefore it uses the UserInterface class to ask for a direction. */ public class UserMoveStrategy implements MoveStrategy { private final UserInterface userInterface; diff --git a/src/test/java/ch/zhaw/pm2/racetrack/GameTest.java b/src/test/java/ch/zhaw/pm2/racetrack/GameTest.java index 2156708..c8810f6 100644 --- a/src/test/java/ch/zhaw/pm2/racetrack/GameTest.java +++ b/src/test/java/ch/zhaw/pm2/racetrack/GameTest.java @@ -1,11 +1,8 @@ package ch.zhaw.pm2.racetrack; import ch.zhaw.pm2.racetrack.strategy.UserMoveStrategy; -import org.junit.jupiter.api.Nested; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.*; + import java.io.File; import java.io.FileNotFoundException; import java.util.List; @@ -14,7 +11,7 @@ import static ch.zhaw.pm2.racetrack.PositionVector.Direction.*; /** - * Test for Class Game + * Test for Class Game. The Class is split up in nested classes. */ class GameTest { private UserInterface userInterface; @@ -26,7 +23,7 @@ class GameTest { private final int CAR_INDEX_TWO = 1; /** - * This nested Class tests if the game gets initiatet correctly + * This nested Class tests if the game gets initiatet correctly. */ @Nested @DisplayName("Test correct Setup") @@ -124,7 +121,8 @@ class GameTest { } /** - * This nested Class tests a Playtrough. And implements a UserInterface interagtion to pretend a real player + * This nested Class tests a playtrough and implements a userInterface which pretends to be a real player. + * At the end of every Test the Userinterface stays open for 10 more sec to visualize the game. */ @Nested @DisplayName("Playtrough") @@ -183,8 +181,28 @@ class GameTest { Assertions.assertEquals("b",game.gamePhase()); } + @Test + void passFinishLineInWrongDirection() { + game = new Game(new interFace("Test",new Integer[]{1,0,1},new PositionVector.Direction[]{LEFT,NONE,NONE,RIGHT,RIGHT})); + game.initPhase(); + Assertions.assertEquals("a",game.gamePhase()); + } + + @AfterEach + void cleanUp() { + try { + Thread.sleep(10000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + /** + * This Class is used to communicate with the UserInterface. It overrides crucial methods and returns an instruction based on the instructions data field. + * To implement the right instructions the user has to be aware of the game sequence. + */ private class interFace extends UserInterface { private PositionVector.Direction[] directions; @@ -210,9 +228,6 @@ class GameTest { public void printInformation(String text) { } - public void printTrack(Track track) { - } - public void quit(String text) { }