Commit e278c17 1 parent e37ad64 commit e278c17 Copy full SHA for e278c17
File tree 1 file changed +20
-0
lines changed
api/src/test/java/lab/en2b/quizapi/game
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -476,4 +476,24 @@ public void testGetGameModes(){
476
476
assertFalse (gameService .getQuestionGameModes ().isEmpty ());
477
477
}
478
478
479
+ @ Test
480
+ public void testGameSetQuestionCategoriesInvalidGameMode (){
481
+ Game g = new Game ();
482
+ g .setGameMode (GameMode .KIWI_QUEST );
483
+ assertThrows (IllegalStateException .class , () -> g .setQuestionCategoriesForCustom (List .of (QuestionCategory .GEOGRAPHY )));
484
+ }
485
+ @ Test
486
+ public void testGameSetQuestionCategoriesInvalidNullCategories (){
487
+ Game g = new Game ();
488
+ g .setGameMode (GameMode .CUSTOM );
489
+ assertThrows (IllegalArgumentException .class , () -> g .setQuestionCategoriesForCustom (null ));
490
+ }
491
+ @ Test
492
+ public void testGameSetQuestionCategoriesInvalidEmptyCategories (){
493
+ Game g = new Game ();
494
+ g .setGameMode (null );
495
+ g .setGameMode (GameMode .CUSTOM );
496
+ List <QuestionCategory > qc = new ArrayList <>();
497
+ assertThrows (IllegalArgumentException .class , () -> g .setQuestionCategoriesForCustom (qc ));
498
+ }
479
499
}
You can’t perform that action at this time.
0 commit comments