Browse Source

Added finished Ghost movement unit test

remotes/origin/playerRefactoring
fdai7753 11 months ago
parent
commit
20264ccef1
  1. 12
      src/test/java/pacmanTests/GhostTest.java

12
src/test/java/pacmanTests/GhostTest.java

@ -12,7 +12,17 @@ class GhostTest {
@Test @Test
void Ghosts_moving_changesPosition() { void Ghosts_moving_changesPosition() {
// arrange
GameManager gameManager = new GameManager();
Ghost ghost = gameManager.ghosts[0];
ghost.position = new Vector2(2,2);
Vector2 direction = new Vector2(1,0);
Vector2 expectedPosition = new Vector2(3,2);
// act
ghost.move(direction);
Vector2 position = ghost.position;
// assert
assertThat(position).isEqualTo(expectedPosition);
} }
} }
Loading…
Cancel
Save