Browse Source

added test for fruit spawning

main
fdai7012 11 months ago
parent
commit
f163f10ef3
  1. 15
      src/test/java/pacmanTests/GameManagerTest.java

15
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);
}
}
Loading…
Cancel
Save