diff --git a/src/test/java/io/graversen/minecraft/rcon/commands/PlayerListCommandTest.java b/src/test/java/io/graversen/minecraft/rcon/commands/PlayerUuidsCommandTest.java similarity index 93% rename from src/test/java/io/graversen/minecraft/rcon/commands/PlayerListCommandTest.java rename to src/test/java/io/graversen/minecraft/rcon/commands/PlayerUuidsCommandTest.java index c1bd629..0cf9d96 100644 --- a/src/test/java/io/graversen/minecraft/rcon/commands/PlayerListCommandTest.java +++ b/src/test/java/io/graversen/minecraft/rcon/commands/PlayerUuidsCommandTest.java @@ -4,7 +4,7 @@ import static org.junit.jupiter.api.Assertions.*; -class PlayerListCommandTest { +class PlayerUuidsCommandTest { @Test void playerListCommand_uuids() { final var command = PlayerListCommand.uuids(); diff --git a/src/test/java/io/graversen/minecraft/rcon/query/playerlist/PlayerNamesMapperTest.java b/src/test/java/io/graversen/minecraft/rcon/query/playerlist/PlayerNamesMapperTest.java new file mode 100644 index 0000000..f48399e --- /dev/null +++ b/src/test/java/io/graversen/minecraft/rcon/query/playerlist/PlayerNamesMapperTest.java @@ -0,0 +1,35 @@ +package io.graversen.minecraft.rcon.query.playerlist; + +import io.graversen.minecraft.rcon.RconResponse; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class PlayerNamesMapperTest { + private final PlayerNamesMapper playerNamesMapper = new PlayerNamesMapper(); + + @Test + void apply_playersOnline() { + final var testRconResponse = + new RconResponse(0, 0, 0, 0, "There are 2 of a max 20 players online: MrSkurk (ab9b6457-e657-4a9c-ace6-22a291f92035), test (bb9b6457-e657-4a9c-ace6-22a291f92035)"); + + final var playerList = playerNamesMapper.apply(testRconResponse); + + assertNotNull(playerList); + assertEquals(2, playerList.getPlayerNames().size()); + assertEquals("MrSkurk", playerList.getPlayerNames().get(0)); + assertEquals("test", playerList.getPlayerNames().get(1)); + + } + + @Test + void apply_noPlayersOnline() { + final var testRconResponse = + new RconResponse(0, 0, 0, 0, "There are 0 of a max 20 players online: "); + + final var playerList = playerNamesMapper.apply(testRconResponse); + + assertNotNull(playerList); + assertTrue(playerList.getPlayerNames().isEmpty()); + } +} \ No newline at end of file diff --git a/src/test/java/io/graversen/minecraft/rcon/query/playerlist/PlayerListMapperTest.java b/src/test/java/io/graversen/minecraft/rcon/query/playerlist/PlayerUuidsMapperTest.java similarity index 79% rename from src/test/java/io/graversen/minecraft/rcon/query/playerlist/PlayerListMapperTest.java rename to src/test/java/io/graversen/minecraft/rcon/query/playerlist/PlayerUuidsMapperTest.java index 430f8d5..e2ffde0 100644 --- a/src/test/java/io/graversen/minecraft/rcon/query/playerlist/PlayerListMapperTest.java +++ b/src/test/java/io/graversen/minecraft/rcon/query/playerlist/PlayerUuidsMapperTest.java @@ -5,15 +5,15 @@ import static org.junit.jupiter.api.Assertions.*; -class PlayerListMapperTest { - private final PlayerListMapper playerListMapper = new PlayerListMapper(); +class PlayerUuidsMapperTest { + private final PlayerUuidsMapper playerUuidsMapper = new PlayerUuidsMapper(); @Test void apply_playersOnline() { final var testRconResponse = new RconResponse(0, 0, 0, 0, "There are 2 of a max 20 players online: MrSkurk (ab9b6457-e657-4a9c-ace6-22a291f92035), test (bb9b6457-e657-4a9c-ace6-22a291f92035)"); - final var playerList = playerListMapper.apply(testRconResponse); + final var playerList = playerUuidsMapper.apply(testRconResponse); assertNotNull(playerList); assertEquals(2, playerList.getPlayerUuids().size()); @@ -26,7 +26,7 @@ void apply_noPlayersOnline() { final var testRconResponse = new RconResponse(0, 0, 0, 0, "There are 0 of a max 20 players online: "); - final var playerList = playerListMapper.apply(testRconResponse); + final var playerList = playerUuidsMapper.apply(testRconResponse); assertNotNull(playerList); assertTrue(playerList.getPlayerUuids().isEmpty());