From 08a17dfea823e66681860b5f6ee1386513062e4d Mon Sep 17 00:00:00 2001 From: fdai7906 Date: Wed, 7 Feb 2024 16:09:40 +0100 Subject: [PATCH] Test.ChangePlayerName --- src/test/java/de/hsfulda/onses/PlayerTest.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/test/java/de/hsfulda/onses/PlayerTest.java b/src/test/java/de/hsfulda/onses/PlayerTest.java index a803321..48b59c9 100644 --- a/src/test/java/de/hsfulda/onses/PlayerTest.java +++ b/src/test/java/de/hsfulda/onses/PlayerTest.java @@ -61,11 +61,23 @@ public class PlayerTest { @Test @DisplayName("GivePlayerName") - public void getPlayerName() { + public void GivePlayerName() { Player player = new Player(); String expected = "Spieler"; player.setPlayerName(expected); String answer = player.getPlayerName(); assertEquals(expected, answer); } + + @Test + @DisplayName("ChangePlayerName") + public void ChangePlayerName() { + PlayerService playerService = new PlayerService(); + String name1 = "Name1"; + String name2 = "Name2"; + playerService.getPlayerList().getFirst().setPlayerName(name1); + playerService.getPlayerList().getFirst().setPlayerName(name2); + String answer = playerService.getPlayerList().getFirst().getPlayerName(); + assertEquals(name2, answer); + } }