Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszouzal-ext92082 committed Dec 6, 2024
1 parent 33f9f74 commit 9ba307b
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ public void shouldThrowExceptionWhenNoQuizFound() {
@Test
public void returnAllQuizes() {

createQuiz();

ResponseEntity<List<QuizData>> response = quizController.getAllQuizes();

assertEquals(HttpStatus.OK, response.getStatusCode());
assertNotNull(response.getBody());
}

private void createQuiz() {
int questionId[] = {0, 1, 2, 3};
QuizCreateData quizData = new QuizCreateData("TestName", questionId);
Quiz quiz = Quiz.builder()
Expand All @@ -55,11 +64,6 @@ public void returnAllQuizes() {
.build();

quizRepository.save(quiz).getId();

ResponseEntity<List<QuizData>> response = quizController.getAllQuizes();

assertEquals(HttpStatus.OK, response.getStatusCode());
assertNotNull(response.getBody());
}

@Test
Expand All @@ -72,6 +76,8 @@ public void shouldThrowExceptionWhenNoQuizForRunFound() {

@Test
public void runQuizCreated() {
createQuiz();

ResponseEntity<Integer> response = quizController.runQuiz(1);

assertEquals(HttpStatus.OK, response.getStatusCode());
Expand Down

0 comments on commit 9ba307b

Please sign in to comment.