From 3f7d2645b394b9e3bdf65dc3d38be9f0a4d9f3f5 Mon Sep 17 00:00:00 2001 From: fdai2751 Date: Thu, 8 Feb 2024 21:31:33 +0100 Subject: [PATCH] Test: JunitTest TestgameOver afterTree Collision With Ghosts --- src/test/java/pacmanTests/GameManagerTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/java/pacmanTests/GameManagerTest.java b/src/test/java/pacmanTests/GameManagerTest.java index c3b095c..5af88ab 100644 --- a/src/test/java/pacmanTests/GameManagerTest.java +++ b/src/test/java/pacmanTests/GameManagerTest.java @@ -64,6 +64,22 @@ class GameManagerTest { game.Pause(); assertTrue(game.isPaused); } + + @Test + void testGameOverwhenGhostCaughtPlayer() { + GameManager game = new GameManager(); + + game.score = 100; + game.handleGhostCollision(); + game.handleGhostCollision(); + game.handleGhostCollision(); + int expectedScore = 0; + + assertThat(game.score).isEqualTo(expectedScore); + + + + } @Test void GameManager_GostPlayerCollisionTest_DoesntDetectColliosion() {