From f163f10ef38e7c7d6031cbfea489bb5f69c1fab1 Mon Sep 17 00:00:00 2001 From: fdai7012 Date: Thu, 8 Feb 2024 02:59:28 +0100 Subject: [PATCH] added test for fruit spawning --- src/test/java/pacmanTests/GameManagerTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/java/pacmanTests/GameManagerTest.java b/src/test/java/pacmanTests/GameManagerTest.java index 8dbb68a..bba944d 100644 --- a/src/test/java/pacmanTests/GameManagerTest.java +++ b/src/test/java/pacmanTests/GameManagerTest.java @@ -108,4 +108,19 @@ class GameManagerTest { boolean expected = true; assertThat(pause).isEqualTo(expected); } + + + @Test + void GameManager_spawnFruit_spawnsFruitAtPlayerSpawn() { + //arrange + GameManager gameManager = new GameManager(); + Cell fruitSpawn = gameManager.map.getCell(gameManager.map.playerSpawn); + String[] expected = {"cherry","strawberry","orange","apple","crystal"}; + //act + + gameManager.spawnFruit(); + String result = fruitSpawn.type; + //assert + assertThat(result).isIn(expected); + } }