From 13ba90228aafc9ecf8f4ba4366ff9cff17bea1b2 Mon Sep 17 00:00:00 2001 From: fdai7012 Date: Thu, 8 Feb 2024 18:08:25 +0100 Subject: [PATCH] refactoring: created for loop to eliminate redundancy --- src/test/java/pacmanTests/GhostTest.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/test/java/pacmanTests/GhostTest.java b/src/test/java/pacmanTests/GhostTest.java index 3a2708d..c4cfb8c 100644 --- a/src/test/java/pacmanTests/GhostTest.java +++ b/src/test/java/pacmanTests/GhostTest.java @@ -93,12 +93,10 @@ class GhostTest { gameManager.ghosts[0].position = new Vector2(25, 1); // act - gameManager.ghosts[0].move(); - gameManager.ghosts[0].move(); - gameManager.ghosts[0].move(); - gameManager.ghosts[0].move(); - gameManager.ghosts[0].move(); - gameManager.ghosts[0].move(); + for(int i = 0; i < 6; i++) { + gameManager.ghosts[0].move(); + } + Vector2 ghostPos = gameManager.ghosts[0].position; // assert