From ba731efa3e776be3c28c418be45cbe8e7f05ffeb Mon Sep 17 00:00:00 2001 From: RicardoDiNu Date: Fri, 26 Apr 2024 20:10:49 +0200 Subject: [PATCH] MultiplayerSession Unit Tests - GameService --- src/test/java/com/uniovi/Wiq_UnitTests.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/test/java/com/uniovi/Wiq_UnitTests.java b/src/test/java/com/uniovi/Wiq_UnitTests.java index 0a86a562..cf792db7 100644 --- a/src/test/java/com/uniovi/Wiq_UnitTests.java +++ b/src/test/java/com/uniovi/Wiq_UnitTests.java @@ -1703,6 +1703,26 @@ public void testScoreMultiplayerCodeAssignment() { Assertions.assertEquals("200", scoreMultiplayerCode); } + @Test + @Order(106) + public void GameSessionImpl_startNewMultiplayerGame() throws InterruptedException, IOException { + sampleDataService.insertSampleQuestions(); + sampleDataService.generateSampleData(); + + Long playerId = 1L; + Player player = createPlayer(); + player.setId(playerId); + + String code = "123"; + playerRepository.findById(playerId); + multiplayerSessionService.multiCreate(code, playerId); + + GameSession multiplayerGame = gameSessionService.startNewMultiplayerGame(player, 123); + + Assertions.assertNotNull(multiplayerGame); + Assertions.assertEquals(player, multiplayerGame.getPlayer()); + } + /** * Sends an HTTP request to the API