From 8222ed42b3f348a18fb7ff8a8f71c169344c80b6 Mon Sep 17 00:00:00 2001 From: fdai2751 Date: Thu, 8 Feb 2024 21:54:04 +0100 Subject: [PATCH] Refactoring: TestplayerlivesRestore with for loop --- src/test/java/pacmanTests/GameManagerTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/java/pacmanTests/GameManagerTest.java b/src/test/java/pacmanTests/GameManagerTest.java index 36cc2c2..a04b788 100644 --- a/src/test/java/pacmanTests/GameManagerTest.java +++ b/src/test/java/pacmanTests/GameManagerTest.java @@ -83,9 +83,9 @@ class GameManagerTest { GameManager game = new GameManager(); game.livesRemaining = 3; - game.handleGhostCollision(); - game.handleGhostCollision(); - game.handleGhostCollision(); + for(int i = 0;i < 3; i++) { + game.handleGhostCollision(); + } int expectedLives = 3; assertThat(game.livesRemaining).isEqualTo(expectedLives); }