diff --git a/api/src/main/java/lab/en2b/quizapi/questions/question/QuestionHelper.java b/api/src/main/java/lab/en2b/quizapi/questions/question/QuestionHelper.java index 2cab945b..f5c20c61 100644 --- a/api/src/main/java/lab/en2b/quizapi/questions/question/QuestionHelper.java +++ b/api/src/main/java/lab/en2b/quizapi/questions/question/QuestionHelper.java @@ -12,20 +12,11 @@ @Component public class QuestionHelper { - private static int MAX_DISTRACTORS = 3; + private QuestionHelper(){} // To hide the implicit public constructor as this is static only - public static List getDistractors(AnswerRepository answerRepository, Question question){ - List distractors = new ArrayList<>(); - AnswerCategory cat = question.getAnswerCategory(); - - switch (cat){ // Write the case only for the exceptions - case COUNTRY: - // Implement more cases - break; - default: - distractors = answerRepository.findDistractors(question.getAnswerCategory().toString(), question.getLanguage(), question.getCorrectAnswer().getText(), MAX_DISTRACTORS); - } + private static final int MAX_DISTRACTORS = 3; - return distractors; + public static List getDistractors(AnswerRepository answerRepository, Question question){ + return answerRepository.findDistractors(question.getAnswerCategory().toString(), question.getLanguage(), question.getCorrectAnswer().getText(), MAX_DISTRACTORS); } }