Source:
public void testValidateQuestionDetails_invalidMaxMinOptions_errorReturned() { FeedbackRankOptionsQuestionDetails feedbackQuestionDetails = new FeedbackRankOptionsQuestionDetails(); List<String> errorResponse = new ArrayList<>(); feedbackQuestionDetails.setMaxOptionsToBeRanked(0); errorResponse.add(FeedbackRankOptionsQuestionDetails.ERROR_INVALID_MAX_OPTIONS_ENABLED); errorResponse.add(FeedbackRankOptionsQuestionDetails.ERROR_NOT_ENOUGH_OPTIONS + FeedbackRankOptionsQuestionDetails.MIN_NUM_OF_OPTIONS + "."); assertEquals(errorResponse, feedbackQuestionDetails.validateQuestionDetails()); errorResponse.clear(); feedbackQuestionDetails = new FeedbackRankOptionsQuestionDetails(); feedbackQuestionDetails.setMinOptionsToBeRanked(1); errorResponse.add(FeedbackRankOptionsQuestionDetails.ERROR_MIN_OPTIONS_ENABLED_MORE_THAN_CHOICES); errorResponse.add(FeedbackRankOptionsQuestionDetails.ERROR_NOT_ENOUGH_OPTIONS + FeedbackRankOptionsQuestionDetails.MIN_NUM_OF_OPTIONS + "."); assertEquals(errorResponse, feedbackQuestionDetails.validateQuestionDetails()); errorResponse.clear(); feedbackQuestionDetails = new FeedbackRankOptionsQuestionDetails(); feedbackQuestionDetails.setMaxOptionsToBeRanked(4); errorResponse.add(FeedbackRankOptionsQuestionDetails.ERROR_MAX_OPTIONS_ENABLED_MORE_THAN_CHOICES); feedbackQuestionDetails.setOptions(Arrays.asList("1", "2", "3")); assertEquals(errorResponse, feedbackQuestionDetails.validateQuestionDetails()); errorResponse.clear(); }

Target:
public void testValidateQuestionDetails_invalidMaxMinOptions_errorReturned() { FeedbackRankOptionsQuestionDetails feedbackQuestionDetails = new FeedbackRankOptionsQuestionDetails(); List<String> errorResponse = new ArrayList<>(); feedbackQuestionDetails.setMaxOptionsToBeRanked(0); errorResponse.add(FeedbackRankOptionsQuestionDetails.ERROR_INVALID_MAX_OPTIONS_ENABLED); errorResponse.add(FeedbackRankOptionsQuestionDetails.ERROR_NOT_ENOUGH_OPTIONS + FeedbackRankOptionsQuestionDetails.MIN_NUM_OF_OPTIONS + "."); assertEquals(errorResponse, feedbackQuestionDetails.validateQuestionDetails()); errorResponse.clear(); feedbackQuestionDetails = new FeedbackRankOptionsQuestionDetails(); feedbackQuestionDetails.setMinOptionsToBeRanked(0); errorResponse.add(FeedbackRankOptionsQuestionDetails.ERROR_INVALID_MIN_OPTIONS_ENABLED); errorResponse.add(FeedbackRankOptionsQuestionDetails.ERROR_NOT_ENOUGH_OPTIONS + FeedbackRankOptionsQuestionDetails.MIN_NUM_OF_OPTIONS + "."); assertEquals(errorResponse, feedbackQuestionDetails.validateQuestionDetails()); errorResponse.clear(); feedbackQuestionDetails.setMinOptionsToBeRanked(1); errorResponse.add(FeedbackRankOptionsQuestionDetails.ERROR_MIN_OPTIONS_ENABLED_MORE_THAN_CHOICES); errorResponse.add(FeedbackRankOptionsQuestionDetails.ERROR_NOT_ENOUGH_OPTIONS + FeedbackRankOptionsQuestionDetails.MIN_NUM_OF_OPTIONS + "."); assertEquals(errorResponse, feedbackQuestionDetails.validateQuestionDetails()); errorResponse.clear(); feedbackQuestionDetails = new FeedbackRankOptionsQuestionDetails(); feedbackQuestionDetails.setMaxOptionsToBeRanked(4); errorResponse.add(FeedbackRankOptionsQuestionDetails.ERROR_MAX_OPTIONS_ENABLED_MORE_THAN_CHOICES); feedbackQuestionDetails.setOptions(Arrays.asList("1", "2", "3")); assertEquals(errorResponse, feedbackQuestionDetails.validateQuestionDetails()); }