diff --git a/src/test/java/teammates/common/datatransfer/questions/FeedbackRankOptionsQuestionDetailsTest.java b/src/test/java/teammates/common/datatransfer/questions/FeedbackRankOptionsQuestionDetailsTest.java index 870dc411be3..2dedf5ad3b5 100644 --- a/src/test/java/teammates/common/datatransfer/questions/FeedbackRankOptionsQuestionDetailsTest.java +++ b/src/test/java/teammates/common/datatransfer/questions/FeedbackRankOptionsQuestionDetailsTest.java @@ -78,6 +78,24 @@ public void testValidateQuestionDetails_invalidMaxMinOptions_errorReturned() { errorResponse.add(FeedbackRankOptionsQuestionDetails.ERROR_MAX_OPTIONS_ENABLED_MORE_THAN_CHOICES); feedbackQuestionDetails.setOptions(Arrays.asList("1", "2", "3")); assertEquals(errorResponse, feedbackQuestionDetails.validateQuestionDetails()); + errorResponse.clear(); + + feedbackQuestionDetails = new FeedbackRankOptionsQuestionDetails(); + feedbackQuestionDetails.setMinOptionsToBeRanked(5); + feedbackQuestionDetails.setMaxOptionsToBeRanked(3); + feedbackQuestionDetails.setOptions(Arrays.asList("1", "2", "3", "4", "5")); + errorResponse.add(FeedbackRankOptionsQuestionDetails.ERROR_INVALID_MIN_OPTIONS_ENABLED); + assertEquals(errorResponse, feedbackQuestionDetails.validateQuestionDetails()); + errorResponse.clear(); + + feedbackQuestionDetails = new FeedbackRankOptionsQuestionDetails(); + feedbackQuestionDetails.setMaxOptionsToBeRanked(0); + feedbackQuestionDetails.setMinOptionsToBeRanked(0); + errorResponse.add(FeedbackRankOptionsQuestionDetails.ERROR_INVALID_MAX_OPTIONS_ENABLED); + errorResponse.add(FeedbackRankOptionsQuestionDetails.ERROR_INVALID_MIN_OPTIONS_ENABLED); + errorResponse.add(FeedbackRankOptionsQuestionDetails.ERROR_NOT_ENOUGH_OPTIONS + + FeedbackRankOptionsQuestionDetails.MIN_NUM_OF_OPTIONS + "."); + assertEquals(errorResponse, feedbackQuestionDetails.validateQuestionDetails()); } @Test