Skip to content

Commit

Permalink
MultiplayerSession Unit Tests - PlayerService(users)
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoDiNu committed Apr 26, 2024
1 parent e0f6fd7 commit dfd89ec
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/test/java/com/uniovi/Wiq_UnitTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -1743,6 +1743,30 @@ public void testRandomMultiplayerQuestions() throws InterruptedException, IOExce
Assertions.assertEquals(5,questions.size());
}

@Test
@Order(108)
public void PlayerServiceImpl_getUsersByMultiplayerCode_ReturnsPlayer() {
Long playerId = 1L;
Player player = createPlayer();
player.setId(playerId);

player.setMultiplayerCode(123);
playerRepository.save(player);

List<Player> result = playerService.getUsersByMultiplayerCode(123);

Assertions.assertEquals(1, result.size());
Assertions.assertEquals(123, result.get(0).getMultiplayerCode());
}

@Test
@Order(109)
public void PlayerServiceImpl_getUsersByMultiplayerCode_ReturnsEmpty() {
List<Player> result = playerService.getUsersByMultiplayerCode(123);

Assertions.assertTrue(result.isEmpty());
}


/**
* Sends an HTTP request to the API
Expand Down

0 comments on commit dfd89ec

Please sign in to comment.