From ebf43b21b4dfecf07d03e521af81d8366bae1bf4 Mon Sep 17 00:00:00 2001 From: fdai2751 Date: Thu, 8 Feb 2024 21:43:36 +0100 Subject: [PATCH] Test: JunitTest for PlayerLivesRestore after Tree time caught from Ghosts --- .../java/pacmanTests/GameManagerTest.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/test/java/pacmanTests/GameManagerTest.java b/src/test/java/pacmanTests/GameManagerTest.java index 5af88ab..36cc2c2 100644 --- a/src/test/java/pacmanTests/GameManagerTest.java +++ b/src/test/java/pacmanTests/GameManagerTest.java @@ -74,13 +74,22 @@ class GameManagerTest { game.handleGhostCollision(); game.handleGhostCollision(); int expectedScore = 0; - - assertThat(game.score).isEqualTo(expectedScore); - - - + assertThat(game.score).isEqualTo(expectedScore); } + + @Test + void testPlayerLivesRestoredwhenGhostCaughtPlayerTreeTime() { + GameManager game = new GameManager(); + + game.livesRemaining = 3; + game.handleGhostCollision(); + game.handleGhostCollision(); + game.handleGhostCollision(); + int expectedLives = 3; + assertThat(game.livesRemaining).isEqualTo(expectedLives); + } + @Test void GameManager_GostPlayerCollisionTest_DoesntDetectColliosion() { // arrange