Skip to content

Commit

Permalink
Merge pull request #282 from Arquisoft/develop
Browse files Browse the repository at this point in the history
Merge new tests to main branch
  • Loading branch information
jjgancfer authored Apr 24, 2024
2 parents 5596ad0 + 994b232 commit d396440
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions api/src/test/java/lab/en2b/quizapi/game/GameServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -476,4 +476,24 @@ public void testGetGameModes(){
assertFalse(gameService.getQuestionGameModes().isEmpty());
}

@Test
public void testGameSetQuestionCategoriesInvalidGameMode(){
Game g = new Game();
g.setGameMode(GameMode.KIWI_QUEST);
assertThrows(IllegalStateException.class, () -> g.setQuestionCategoriesForCustom(List.of(QuestionCategory.GEOGRAPHY)));
}
@Test
public void testGameSetQuestionCategoriesInvalidNullCategories(){
Game g = new Game();
g.setGameMode(GameMode.CUSTOM);
assertThrows(IllegalArgumentException.class, () -> g.setQuestionCategoriesForCustom(null));
}
@Test
public void testGameSetQuestionCategoriesInvalidEmptyCategories(){
Game g = new Game();
g.setGameMode(null);
g.setGameMode(GameMode.CUSTOM);
List<QuestionCategory> qc = new ArrayList<>();
assertThrows(IllegalArgumentException.class, () -> g.setQuestionCategoriesForCustom(qc));
}
}

0 comments on commit d396440

Please sign in to comment.