From 4d502c322d0e1b2bd0966f909457ee1577ccc081 Mon Sep 17 00:00:00 2001 From: fdai7753 Date: Wed, 7 Feb 2024 19:03:00 +0100 Subject: [PATCH] Added a ghost spawn unit test in GameManagerTest --- src/test/java/pacmanTests/GameManagerTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/test/java/pacmanTests/GameManagerTest.java b/src/test/java/pacmanTests/GameManagerTest.java index 175852b..6838cb3 100644 --- a/src/test/java/pacmanTests/GameManagerTest.java +++ b/src/test/java/pacmanTests/GameManagerTest.java @@ -75,4 +75,17 @@ class GameManagerTest { // assert assertThat(colision).isEqualTo(expected); } + @Test + void GameManager_setupgame_spawnsghosts() { + + // arrange + GameManager gameManager = new GameManager(); + gameManager.map.ghostSpawns[0] = new Vector2(1, 1); + Vector2 expectedPosition = new Vector2(1, 1); + // act + gameManager.ghosts[0].spawn(); + Vector2 ghostPositeion = gameManager.ghosts[0].position; + // assert + assertThat(ghostPositeion).isEqualTo(expectedPosition); + } }