-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
76aecb3
commit ba7afcb
Showing
4 changed files
with
64 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/test/java/io/graversen/minecraft/rcon/query/playerlist/PlayerListMapperTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
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 PlayerListMapperTest { | ||
private final PlayerListMapper playerListMapper = new PlayerListMapper(); | ||
|
||
@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); | ||
|
||
assertNotNull(playerList); | ||
assertEquals(2, playerList.getPlayerUuids().size()); | ||
assertEquals("ab9b6457-e657-4a9c-ace6-22a291f92035", playerList.getPlayerUuids().get(0)); | ||
assertEquals("bb9b6457-e657-4a9c-ace6-22a291f92035", playerList.getPlayerUuids().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 = playerListMapper.apply(testRconResponse); | ||
|
||
assertNotNull(playerList); | ||
assertTrue(playerList.getPlayerUuids().isEmpty()); | ||
} | ||
} |