From 1ded07cd00b5145388665ee00836fa152cb14598 Mon Sep 17 00:00:00 2001 From: David Hermann Date: Wed, 1 Feb 2023 20:17:10 +0100 Subject: [PATCH] unittest: updated player test This additionally tests if the player has a location by testing the name of the location related to the player --- .../java/org/bitbiome/entitiesTest/PlayerTest.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/java/org/bitbiome/entitiesTest/PlayerTest.java b/src/test/java/org/bitbiome/entitiesTest/PlayerTest.java index df03dfd..2205e95 100644 --- a/src/test/java/org/bitbiome/entitiesTest/PlayerTest.java +++ b/src/test/java/org/bitbiome/entitiesTest/PlayerTest.java @@ -2,6 +2,7 @@ package org.bitbiome.entitiesTest; import static org.junit.jupiter.api.Assertions.assertEquals; +import org.bitbiome.entities.Location; import org.bitbiome.entities.Player; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -9,12 +10,17 @@ import org.junit.jupiter.api.Test; public class PlayerTest { private static Player player; + private static Location location; @BeforeAll public static void setPlayer() { player = new Player(); + location = new Location(); + + location.setName("NewUnitWorld"); player.setName("UnitPlayer"); + player.setLocation(location); player.setHp(100F); } @@ -29,4 +35,9 @@ public class PlayerTest { assertEquals(100F, player.getHp()); } + @Test + public void testLocationNameFromPlayer() { + assertEquals("NewUnitWorld", player.getLocation().getName()); + } + }