From 20264ccef12e64c128c269bf43b5558460911ac0 Mon Sep 17 00:00:00 2001 From: fdai7753 Date: Wed, 7 Feb 2024 22:34:06 +0100 Subject: [PATCH] Added finished Ghost movement unit test --- src/test/java/pacmanTests/GhostTest.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/test/java/pacmanTests/GhostTest.java b/src/test/java/pacmanTests/GhostTest.java index 4f8494d..19b053b 100644 --- a/src/test/java/pacmanTests/GhostTest.java +++ b/src/test/java/pacmanTests/GhostTest.java @@ -12,7 +12,17 @@ class GhostTest { @Test 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); } } \ No newline at end of file