Skip to content

Commit

Permalink
[#1501] Add tests cases to FeedbackRankOptionsQuestionDetails (#12475)
Browse files Browse the repository at this point in the history
* Update FeedbackRankOptionsQuestionDetailsTest.java

Adding test case to
testValidateQuestionDetails_invalidMaxMinOptions_errorReturned()

* Update FeedbackRankOptionsQuestionDetailsTest.java

Adding new test case to FeedbackRankOptionsQuestionDetailsTest

---------

Co-authored-by: Dominic Lim <46486515+domlimm@users.noreply.github.com>
Co-authored-by: Wei Qing <48304907+weiquu@users.noreply.github.com>
  • Loading branch information
3 people committed Jun 26, 2023
1 parent 86c328b commit bc1e5f5
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bc1e5f5

Please sign in to comment.