From 174b2f8343bf89a33660e4a96196a71aa6483e83 Mon Sep 17 00:00:00 2001 From: fdai7012 Date: Thu, 8 Feb 2024 04:19:42 +0100 Subject: [PATCH] refactoring: formatting --- .../java/pacmanTests/GameManagerTest.java | 25 +++++-------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/test/java/pacmanTests/GameManagerTest.java b/src/test/java/pacmanTests/GameManagerTest.java index 7c1127d..f4a17c6 100644 --- a/src/test/java/pacmanTests/GameManagerTest.java +++ b/src/test/java/pacmanTests/GameManagerTest.java @@ -14,68 +14,55 @@ class GameManagerTest { void GameManager_Update_increasesTime() { // arrange GameManager gameManager = new GameManager(); - // act - int expectedUpdatedTime = gameManager.time + 1; gameManager.Update(); int updatedTime = gameManager.time; - - // assert assertThat(expectedUpdatedTime).isEqualTo(updatedTime); } - + @Test void GameManager_Update_updatesVisualizer() { // arrange - GameManager gameManager = new GameManager(); gameManager.visualizer = new VisualizerPlainTextUltra(gameManager); VisualizerPlainTextUltra vptu = (VisualizerPlainTextUltra) gameManager.visualizer; - // act - String initialVptOutput = (String)vptu.GetOutput(); gameManager.Update(); String updatedVptOutput = (String)vptu.GetOutput(); - - // assert assertThat(initialVptOutput).isNotEqualTo(updatedVptOutput); } + @Test void GameManager_GostPlayerColisionTest_DetectsColosion() { - // arrange - GameManager gameManager = new GameManager(); gameManager.player.position = gameManager.ghosts[0].position.Clone(); //act boolean collision = gameManager.ghostPlayerColisionTest(); boolean expected = true; - // assert assertThat(collision).isEqualTo(expected); } + @Test void GameManager_GostPlayerCollisionTest_DoesntDetectColliosion() { - // arrange - GameManager gameManager = new GameManager(); gameManager.player.position = new Vector2(2,3); gameManager.ghosts[0].position = new Vector2(4,5); //act boolean collision = gameManager.ghostPlayerColisionTest(); boolean expected = false; - // assert assertThat(collision).isEqualTo(expected); } + @Test void GameManager_setupgame_spawnsghosts() { - // arrange GameManager gameManager = new GameManager(); gameManager.map.ghostSpawns[0] = new Vector2(1, 1); @@ -96,6 +83,7 @@ class GameManagerTest { boolean expected = false; assertThat(pause).isEqualTo(expected); } + @Test void GameManager_Pause_NotPause() { GameManager gameManager = new GameManager(); @@ -104,7 +92,7 @@ class GameManagerTest { boolean pause = gameManager.isPaused; boolean expected = true; assertThat(pause).isEqualTo(expected); - } + } @Test @@ -114,7 +102,6 @@ class GameManagerTest { Cell fruitSpawn = gameManager.map.getCell(gameManager.map.playerSpawn); String[] expected = {"cherry","strawberry","orange","apple","crystal"}; //act - gameManager.spawnFruit(); String result = fruitSpawn.type; //assert