Skip to content

Commit

Permalink
corrected in error in testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Fierro committed Apr 16, 2024
1 parent 2fa7ea2 commit bacaf01
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/test/java/uta/cse3310/LeaderboardTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.junit.Before;
import org.junit.Test;
import java.util.List;
import java.util.Map;

public class LeaderboardTest {

Expand All @@ -27,16 +28,19 @@ public void setUp() {
public void testAddOrUpdatePlayer() {
// Check if players are added correctly
assertEquals(3, leaderboard.getSortedPlayers().size());
// Update an existing player's score

leaderboard.addOrUpdatePlayer(player1, 200);
assertEquals(Integer.valueOf(200), leaderboard.getPlayerScores().get(player1));

// Update an existing player's score
Map<PlayerType, Integer> scores = leaderboard.getPlayerScores();
assertEquals(Integer.valueOf(200), scores.get(player1));
}

@Test
public void testGetSortedPlayers() {
List<PlayerType> sortedPlayers = leaderboard.getSortedPlayers();
assertEquals("Erik", sortedPlayers.get(0).getNickname()); // Anthony should be first with the highest score
assertEquals("Anthony", sortedPlayers.get(1).getNickname()); // Erik second
assertEquals("Anthony", sortedPlayers.get(0).getNickname()); // Anthony should be first with the highest score
assertEquals("Erik", sortedPlayers.get(1).getNickname()); // Erik second
assertEquals("Brianna", sortedPlayers.get(2).getNickname()); // Brianna last
}

Expand Down

0 comments on commit bacaf01

Please sign in to comment.