Browse Source

Added a ghost spawn unit test in GameManagerTest

remotes/origin/ghostsbehaviour
fdai7753 11 months ago
parent
commit
4d502c322d
  1. 13
      src/test/java/pacmanTests/GameManagerTest.java

13
src/test/java/pacmanTests/GameManagerTest.java

@ -75,4 +75,17 @@ class GameManagerTest {
// assert // assert
assertThat(colision).isEqualTo(expected); assertThat(colision).isEqualTo(expected);
} }
@Test
void GameManager_setupgame_spawnsghosts() {
// arrange
GameManager gameManager = new GameManager();
gameManager.map.ghostSpawns[0] = new Vector2(1, 1);
Vector2 expectedPosition = new Vector2(1, 1);
// act
gameManager.ghosts[0].spawn();
Vector2 ghostPositeion = gameManager.ghosts[0].position;
// assert
assertThat(ghostPositeion).isEqualTo(expectedPosition);
}
} }
Loading…
Cancel
Save