From 45cffafb6bd7a6e511dd37300139c1407f99b197 Mon Sep 17 00:00:00 2001 From: romanschenk37 <84532681+romanschenk37@users.noreply.github.com> Date: Fri, 25 Mar 2022 23:40:41 +0100 Subject: [PATCH 1/4] code cleanup --- .../{MoveStrategyTest.java => MoveListStrategyTest.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/test/java/ch/zhaw/pm2/racetrack/{MoveStrategyTest.java => MoveListStrategyTest.java} (96%) diff --git a/src/test/java/ch/zhaw/pm2/racetrack/MoveStrategyTest.java b/src/test/java/ch/zhaw/pm2/racetrack/MoveListStrategyTest.java similarity index 96% rename from src/test/java/ch/zhaw/pm2/racetrack/MoveStrategyTest.java rename to src/test/java/ch/zhaw/pm2/racetrack/MoveListStrategyTest.java index 5796364..28fe8f0 100644 --- a/src/test/java/ch/zhaw/pm2/racetrack/MoveStrategyTest.java +++ b/src/test/java/ch/zhaw/pm2/racetrack/MoveListStrategyTest.java @@ -10,7 +10,7 @@ import java.io.FileNotFoundException; /** * This Class tests the MoveStrategy. */ -public class MoveStrategyTest { +public class MoveListStrategyTest { private MoveStrategy moveList; From b4664cd8540c476ef82e188ec30bcf9853f8d2e4 Mon Sep 17 00:00:00 2001 From: romanschenk37 <84532681+romanschenk37@users.noreply.github.com> Date: Fri, 25 Mar 2022 23:44:06 +0100 Subject: [PATCH 2/4] Javadoc in MoveListStrategyTest --- .../java/ch/zhaw/pm2/racetrack/MoveListStrategyTest.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/test/java/ch/zhaw/pm2/racetrack/MoveListStrategyTest.java b/src/test/java/ch/zhaw/pm2/racetrack/MoveListStrategyTest.java index 28fe8f0..88c3f28 100644 --- a/src/test/java/ch/zhaw/pm2/racetrack/MoveListStrategyTest.java +++ b/src/test/java/ch/zhaw/pm2/racetrack/MoveListStrategyTest.java @@ -14,10 +14,14 @@ public class MoveListStrategyTest { private MoveStrategy moveList; + @Nested @DisplayName("MoveListStrategy") class MoveList { + /** + * Creates a new MoveListStrategy + */ @BeforeEach void setup() { try { @@ -27,6 +31,9 @@ public class MoveListStrategyTest { } } + /** + * Checks if the directions are returned correct by method nextMove + */ @Test void checkMove() { Assertions.assertEquals(PositionVector.Direction.RIGHT,moveList.nextMove()); From 591bbc423d06d770c9af4b3eb25af0d53cb8f9a7 Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Fri, 25 Mar 2022 23:44:56 +0100 Subject: [PATCH 3/4] javadoc --- .../java/ch/zhaw/pm2/racetrack/TrackTest.java | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/test/java/ch/zhaw/pm2/racetrack/TrackTest.java b/src/test/java/ch/zhaw/pm2/racetrack/TrackTest.java index 807a832..164b0a7 100644 --- a/src/test/java/ch/zhaw/pm2/racetrack/TrackTest.java +++ b/src/test/java/ch/zhaw/pm2/racetrack/TrackTest.java @@ -29,12 +29,18 @@ public class TrackTest { } + /** + * Checks if correct amount of cars has been instantiated + */ @Test @DisplayName("Create correct amount of Car instance") void checkCars() { Assertions.assertEquals(2, trackObj.getCarCount()); } + /** + * Checks if car id matches track file symbol + */ @Test @DisplayName("Create Car instance with correct Symbols / Id") void checkCarId() { @@ -42,13 +48,18 @@ public class TrackTest { Assertions.assertEquals('b', trackObj.getCarId(1)); } - + /** + * checks if track reads space typ from track file correctly + */ @Test @DisplayName("Check getSpaceTyp") void getSpaceTyp() { Assertions.assertEquals(ConfigSpecification.SpaceType.FINISH_RIGHT, trackObj.getSpaceType(new PositionVector(22, 24))); } + /** + * checks if track finds the finish line at the correct positions + */ @Test @DisplayName("Find FinishLine") void findFinish() { @@ -59,6 +70,9 @@ public class TrackTest { Assertions.assertEquals(expected, trackObj.getFinishLine()); } + /** + * Checks if track does read in track file correctly + */ @Test @DisplayName("Converts track file correctly to List") void checkTrack() { @@ -86,6 +100,9 @@ public class TrackTest { } } + /** + * checks if track does process car move correctly + */ @Test @DisplayName("Make Car move down on track") void makeCarMoveDown() { @@ -97,6 +114,9 @@ public class TrackTest { Assertions.assertEquals(beforeMove.getX(), afterMove.getX()); } + /** + * Checks if car does not move if there is no acceleartion + */ @Test @DisplayName("Make Car move with (0,0) acceleration on track") void makeCarStay() { @@ -107,6 +127,9 @@ public class TrackTest { Assertions.assertEquals(beforeMove.getX(), afterMove.getX()); } + /** + * Checks if car does crash + */ @Test @DisplayName("Will Car Crash") void willCarCrash() { @@ -119,6 +142,9 @@ public class TrackTest { } + /** + * checks if track is updated after car crash + */ @Test @DisplayName("Make Car Crash") void makeCarCrash() { @@ -128,10 +154,14 @@ public class TrackTest { } } + /** + * This testcase does check for negative test cases + */ @Nested @DisplayName("Negative TestCase") class negativeClass { File file; + @BeforeEach void setup() { file = new File(".\\tracks\\challenge.txt"); @@ -143,6 +173,9 @@ public class TrackTest { } } + /** + * Tries to read not valid file + */ @Test @DisplayName("Throw error if File not found") void canReadFile() { @@ -150,6 +183,9 @@ public class TrackTest { Assertions.assertThrows(FileNotFoundException.class, () -> new Track(file)); } + /** + * Tries to read not valid file with 2 cars with same symbol + */ @Test @DisplayName("Throw error if File is invalid") void invalidTrackFile() { From 3ed26fb90949fe35314a2cdf20cb4fe42f1afc87 Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Fri, 25 Mar 2022 23:46:06 +0100 Subject: [PATCH 4/4] javadoc --- src/test/java/ch/zhaw/pm2/racetrack/TrackTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/java/ch/zhaw/pm2/racetrack/TrackTest.java b/src/test/java/ch/zhaw/pm2/racetrack/TrackTest.java index 164b0a7..ce8bd47 100644 --- a/src/test/java/ch/zhaw/pm2/racetrack/TrackTest.java +++ b/src/test/java/ch/zhaw/pm2/racetrack/TrackTest.java @@ -14,8 +14,8 @@ public class TrackTest { Track trackObj; @Nested - @DisplayName("Positiv Test Cases") - class positivClass { + @DisplayName("Positive Test Cases") + class positiveClass { @BeforeEach void setup() { @@ -115,7 +115,7 @@ public class TrackTest { } /** - * Checks if car does not move if there is no acceleartion + * Checks if car does not move if there is no acceleration */ @Test @DisplayName("Make Car move with (0,0) acceleration on track")