From 917c968b14004fd671277cb5ed8dd468f24e9eef Mon Sep 17 00:00:00 2001 From: fdai7012 Date: Thu, 8 Feb 2024 02:53:33 +0100 Subject: [PATCH] added test for player spawning --- src/test/java/pacmanTests/PlayerTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/java/pacmanTests/PlayerTest.java b/src/test/java/pacmanTests/PlayerTest.java index 3cd3d87..e30ea0f 100644 --- a/src/test/java/pacmanTests/PlayerTest.java +++ b/src/test/java/pacmanTests/PlayerTest.java @@ -131,4 +131,19 @@ class PlayerTest { // assert assertThat(direction).isEqualTo(expectedDdirection); } + + + @Test + void Player_spawn_setsPosition() { + // arrange + GameManager gameManager = new GameManager(); + Player player = gameManager.player; + + Vector2 expectedPosition = gameManager.map.playerSpawn.Clone(); + // act + player.Spawn(); + Vector2 position = player.position; + // assert + assertThat(position).isEqualTo(expectedPosition); + } }