Browse Source

unittest: updated player test

This additionally tests if the player has a location by testing the name of the location related to the player
remotes/origin/develop
David Hermann 2 years ago
parent
commit
1ded07cd00
  1. 11
      src/test/java/org/bitbiome/entitiesTest/PlayerTest.java

11
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 static org.junit.jupiter.api.Assertions.assertEquals;
import org.bitbiome.entities.Location;
import org.bitbiome.entities.Player; import org.bitbiome.entities.Player;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -9,12 +10,17 @@ import org.junit.jupiter.api.Test;
public class PlayerTest { public class PlayerTest {
private static Player player; private static Player player;
private static Location location;
@BeforeAll @BeforeAll
public static void setPlayer() { public static void setPlayer() {
player = new Player(); player = new Player();
location = new Location();
location.setName("NewUnitWorld");
player.setName("UnitPlayer"); player.setName("UnitPlayer");
player.setLocation(location);
player.setHp(100F); player.setHp(100F);
} }
@ -29,4 +35,9 @@ public class PlayerTest {
assertEquals(100F, player.getHp()); assertEquals(100F, player.getHp());
} }
@Test
public void testLocationNameFromPlayer() {
assertEquals("NewUnitWorld", player.getLocation().getName());
}
} }
Loading…
Cancel
Save