From e0f6fd7bdfe09d73659d6c23b9592dc1243724d2 Mon Sep 17 00:00:00 2001 From: RicardoDiNu Date: Fri, 26 Apr 2024 20:15:23 +0200 Subject: [PATCH] MultiplayerSession Unit Tests - QuestionService --- 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 cf792db7..ef05ca87 100644 --- a/src/test/java/com/uniovi/Wiq_UnitTests.java +++ b/src/test/java/com/uniovi/Wiq_UnitTests.java @@ -1723,6 +1723,26 @@ public void GameSessionImpl_startNewMultiplayerGame() throws InterruptedExcepti Assertions.assertEquals(player, multiplayerGame.getPlayer()); } + @Test + @Order(107) + public void testRandomMultiplayerQuestions() 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); + + + List questions = questionService.getRandomMultiplayerQuestions(5, 123); + + Assertions.assertEquals(5,questions.size()); + } + /** * Sends an HTTP request to the API