diff --git a/src/test/java/uta/cse3310/ScoreboardTest.java b/src/test/java/uta/cse3310/ScoreboardTest.java index 96284a5..bfb4fa2 100644 --- a/src/test/java/uta/cse3310/ScoreboardTest.java +++ b/src/test/java/uta/cse3310/ScoreboardTest.java @@ -1,41 +1,35 @@ package uta.cse3310; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.BeforeEach; import static org.junit.jupiter.api.Assertions.*; import java.util.List; class ScoreboardTest { - - private Scoreboard scoreboard; - @BeforeEach - void setUp() { - scoreboard = new Scoreboard(); - } + @Test + void testUpdateScoreboard() { + Scoreboard scoreboard = new Scoreboard(); + Player player1 = new Player("1", "Player1"); + player1.updateScore(100); + scoreboard.updateScoreboard(player1); - @Test - void testUpdateScoreboard() { - Player player1 = new Player("1", "Player1"); - player1.updateScore(100); - scoreboard.updateScoreboard(player1); + List topPlayers = scoreboard.getTopPlayers(); + assertEquals(1, topPlayers.size()); + assertEquals("Player1", topPlayers.get(0).getName()); + assertEquals(100, topPlayers.get(0).getScore()); + } - List topPlayers = scoreboard.getTopPlayers(); - assertEquals(1, topPlayers.size()); - assertEquals("Player1", topPlayers.get(0).getName()); - assertEquals(100, topPlayers.get(0).getScore()); + @Test + void testTopPlayersLimit() { + Scoreboard scoreboard = new Scoreboard(); + for (int i = 0; i < 15; i++) { + Player player = new Player(String.valueOf(i), "Player" + i); + player.updateScore(i * 100); + scoreboard.updateScoreboard(player); } - @Test - void testTopPlayersLimit() { - for (int i = 0; i < 15; i++) { - Player player = new Player(String.valueOf(i), "Player" + i); - player.updateScore(i * 100); - scoreboard.updateScoreboard(player); - } - - List topPlayers = scoreboard.getTopPlayers(); - assertEquals(10, topPlayers.size()); - assertEquals(1400, topPlayers.get(0).getScore()); - } -} + List topPlayers = scoreboard.getTopPlayers(); + assertEquals(10, topPlayers.size()); + assertEquals(1400, topPlayers.get(0).getScore()); + } +} \ No newline at end of file