Skip to content

Commit

Permalink
MultiplayerSession Unit Tests - PlayerService(session and code)
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoDiNu committed Apr 26, 2024
1 parent 05e25ee commit 183e050
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/test/java/com/uniovi/Wiq_UnitTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -1799,8 +1799,36 @@ public void PlayerServiceImpl_setANDgetScoreMultiplayerCode_EmptyPlayer() {
Assertions.assertEquals("", result);
}

@Test
@Order(112)
public void PlayerServiceImpl_createMultiplayerGame() {
Long playerId = 1L;

int result = playerService.createMultiplayerGame(playerId);
Assertions.assertNotEquals(-1, result);
}

@Test
@Order(113)
public void PlayerServiceImpl_createMultiplayerGame_EmptyPlayer() {
Long playerId = 5L;

int result = playerService.createMultiplayerGame(playerId);
Assertions.assertEquals(-1, result);
}

@Test
@Order(114)
public void PlayerServiceImpl_deleteMultiplayerCode() {
Long playerId = 1L;
Player player = createPlayer();
player.setId(playerId);
playerRepository.save(player);
playerService.createMultiplayerGame(playerId);

playerService.deleteMultiplayerCode(playerId);
Assertions.assertNull(player.getMultiplayerCode());
}



Expand Down

0 comments on commit 183e050

Please sign in to comment.