From 09be8bfa4d99c8829f900ba936f39ec4781c8ca8 Mon Sep 17 00:00:00 2001 From: fdai2751 Date: Thu, 8 Feb 2024 21:57:31 +0100 Subject: [PATCH] Refactoring: testGameOver implement better with the for loop --- src/test/java/pacmanTests/GameManagerTest.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/test/java/pacmanTests/GameManagerTest.java b/src/test/java/pacmanTests/GameManagerTest.java index a04b788..64c4131 100644 --- a/src/test/java/pacmanTests/GameManagerTest.java +++ b/src/test/java/pacmanTests/GameManagerTest.java @@ -70,9 +70,10 @@ class GameManagerTest { GameManager game = new GameManager(); game.score = 100; - game.handleGhostCollision(); - game.handleGhostCollision(); - game.handleGhostCollision(); + + for(int i = 0;i < 3; i++) { + game.handleGhostCollision(); + } int expectedScore = 0; assertThat(game.score).isEqualTo(expectedScore); }