-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFakerQuestionSource.java
More file actions
28 lines (25 loc) · 997 Bytes
/
Copy pathFakerQuestionSource.java
File metadata and controls
28 lines (25 loc) · 997 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
* PART D: Question Sourcing Integration
* Concrete QuestionSource - procedurally generates mock question content
* at runtime via the QuestionFaker context.
*/
public class FakerQuestionSource implements QuestionSource {
private final String questionType;
/**
* @param questionType The type of question to generate: MCQ, True/False, Essay, Programming.
*/
public FakerQuestionSource(String questionType) {
this.questionType = questionType;
}
@Override
public Question getQuestion() {
return switch (questionType.toLowerCase()) {
case "mcq" -> QuestionFaker.fakeMCQ();
case "true/false" -> QuestionFaker.fakeTrueFalse();
case "essay" -> QuestionFaker.fakeEssay();
case "programming" -> QuestionFaker.fakeProgramming();
default -> throw new IllegalArgumentException(
"Unknown question type for Faker: " + questionType);
};
}
}