Skip to content

Commit 10071ca

Browse files
documentation
1 parent 85805cd commit 10071ca

File tree

3 files changed

+83
-60
lines changed

3 files changed

+83
-60
lines changed

src/main/java/quiz_use_case/QuizResponseModel.java

Lines changed: 44 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -80,76 +80,91 @@ public QuizResponseModel(boolean failed, String message) {
8080
this.message = message;
8181
}
8282

83-
/** GETTERS AND SETTERS **/
83+
/**
84+
* Gets the failed value.
85+
* @return true if response has failed
86+
*/
8487
public boolean isFailed() {
8588
return failed;
8689
}
8790

88-
public void setFailed(boolean failed) {
89-
this.failed = failed;
90-
}
91-
91+
/**
92+
* Gets the message.
93+
* @return the message
94+
*/
9295
public String getMessage() {
9396
return message;
9497
}
9598

99+
/**
100+
* Sets the message.
101+
* @param message the message
102+
*/
96103
public void setMessage(String message) {
97104
this.message = message;
98105
}
99106

107+
/**
108+
* Returns true if the response needs confirmation from the user.
109+
* @return need confirmation
110+
*/
100111
public boolean needToConfirm() {
101112
return needConfirmation;
102113
}
103114

104-
public void setNeedConfirmation(boolean needConfirmation) {
105-
this.needConfirmation = needConfirmation;
106-
}
107-
115+
/**
116+
* Gets the score.
117+
* @return the score
118+
*/
108119
public int getScore() {
109120
return score;
110121
}
111122

112-
public void setScore(int score) {
113-
this.score = score;
114-
}
115-
123+
/**
124+
* Gets the number of questions.
125+
* @return the number of questions
126+
*/
116127
public int getNumQuestions() {
117128
return numQuestions;
118129
}
119130

120-
public void setNumQuestions(int numQuestions) {
121-
this.numQuestions = numQuestions;
122-
}
123-
131+
/**
132+
* Gets the list of question types.
133+
* @return the types
134+
*/
124135
public List<String> getTypes() {
125136
return types;
126137
}
127138

128-
public void setTypes(List<String> types) {
129-
this.types = types;
130-
}
131-
139+
/**
140+
* Gets the output text.
141+
* @return the list of lists of output text
142+
*/
132143
public List<List<String>> getOutputText() {
133144
return outputText;
134145
}
135146

147+
/**
148+
* Sets the output text.
149+
* @param outputText the list of lists of output text
150+
*/
136151
public void setOutputText(List<List<String>> outputText) {
137152
this.outputText = outputText;
138153
}
139154

155+
/**
156+
* Gets the user answers.
157+
* @return the user answers
158+
*/
140159
public List<String> getUserAnswers() {
141160
return userAnswers;
142161
}
143162

144-
public void setUserAnswers(List<String> userAnswers) {
145-
this.userAnswers = userAnswers;
146-
}
147-
163+
/**
164+
* Gets the actual answers.
165+
* @return the actual answers
166+
*/
148167
public List<String> getActualAnswers() {
149168
return actualAnswers;
150169
}
151-
152-
public void setActualAnswers(List<String> actualAnswers) {
153-
this.actualAnswers = actualAnswers;
154-
}
155170
}

src/main/java/quiz_use_case/QuizSettingsRequestModel.java

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -44,59 +44,66 @@ public QuizSettingsRequestModel(int flashcardSetID) {
4444
this.flashcardSetID = flashcardSetID;
4545
}
4646

47-
/** GETTERS AND SETTERS **/
47+
/**
48+
* Gets the number of questions.
49+
* @return the number of questions
50+
*/
4851
public int getNumQuestions() {
4952
return numQuestions;
5053
}
5154

52-
public void setNumQuestions(int numQuestions) {
53-
this.numQuestions = numQuestions;
54-
}
55-
55+
/**
56+
* Gets the timer boolean value.
57+
* @return true if the timer is on
58+
*/
5659
public boolean isTimerOn() {
5760
return timerOn;
5861
}
5962

60-
public void setTimerOn(boolean timerOn) {
61-
this.timerOn = timerOn;
62-
}
63-
63+
/**
64+
* Gets the timer duration.
65+
* @return the timer duration
66+
*/
6467
public int getTimerDuration() {
6568
return timerDuration;
6669
}
6770

68-
public void setTimerDuration(int timerDuration) {
69-
this.timerDuration = timerDuration;
70-
}
71-
71+
/**
72+
* Gets the multiple choice boolean value.
73+
* @return true if multiple choice is on
74+
*/
7275
public boolean isMultipleChoiceOn() {
7376
return multipleChoiceOn;
7477
}
7578

76-
public void setMultipleChoiceOn(boolean multipleChoiceOn) {
77-
this.multipleChoiceOn = multipleChoiceOn;
78-
}
79-
79+
/**
80+
* Gets the text entry boolean value.
81+
* @return true if text entry is on
82+
*/
8083
public boolean isTextEntryOn() {
8184
return textEntryOn;
8285
}
8386

84-
public void setTextEntryOn(boolean textEntryOn) {
85-
this.textEntryOn = textEntryOn;
86-
}
87-
87+
/**
88+
* Gets the true/false boolean value.
89+
* @return true if true/false is on
90+
*/
8891
public boolean isTrueFalseOn() {
8992
return trueFalseOn;
9093
}
9194

92-
public void setTrueFalseOn(boolean trueFalseOn) {
93-
this.trueFalseOn = trueFalseOn;
94-
}
95-
95+
/**
96+
* Gets the flashcard set ID
97+
* @return the flashcard set ID
98+
*/
9699
public int getFlashcardSetID() {
97100
return flashcardSetID;
98101
}
99102

103+
/**
104+
* Sets the flashcard set ID
105+
* @param flashcardSetID the flashcard set ID
106+
*/
100107
public void setFlashcardSetID(int flashcardSetID) {
101108
this.flashcardSetID = flashcardSetID;
102109
}

src/test/java/quiz_use_case/QuizUseCaseTest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import java.io.IOException;
88
import java.util.ArrayList;
9+
import java.util.List;
910

1011
/**
1112
* This class contains various test cases for the quiz use case.
@@ -58,16 +59,16 @@ void testOnlyMultipleChoice() throws IOException {
5859
QuizSettingsResponseModel quizSettingsResponseModel = controller.startQuiz(quizSettingsRequestModel);
5960
assertFalse(quizSettingsResponseModel.isFailed());
6061

61-
ArrayList<String> types = quizSettingsResponseModel.getTypes();
62-
ArrayList<ArrayList<String>> outputText = quizSettingsResponseModel.getOutputText();
62+
List<String> types = quizSettingsResponseModel.getTypes();
63+
List<List<String>> outputText = quizSettingsResponseModel.getOutputText();
6364

6465
assertEquals(10, types.size());
6566
assertEquals(10, outputText.size());
6667
assertTrue(types.contains("MC"));
6768
assertFalse(types.contains("TE"));
6869
assertFalse(types.contains("TF"));
6970

70-
ArrayList<String> userAnswers = new ArrayList<>();
71+
List<String> userAnswers = new ArrayList<>();
7172
for (int i = 0; i < 10; i++) {
7273
userAnswers.add("incorrect answer");
7374
}
@@ -92,14 +93,14 @@ void testAllOptionsEnabled() throws IOException {
9293
QuizSettingsResponseModel quizSettingsResponseModel = controller.startQuiz(quizSettingsRequestModel);
9394
assertFalse(quizSettingsResponseModel.isFailed());
9495

95-
ArrayList<String> types = quizSettingsResponseModel.getTypes();
96-
ArrayList<ArrayList<String>> outputText = quizSettingsResponseModel.getOutputText();
96+
List<String> types = quizSettingsResponseModel.getTypes();
97+
List<List<String>> outputText = quizSettingsResponseModel.getOutputText();
9798

9899
assertEquals(12, types.size());
99100
assertEquals(12, outputText.size());
100101
assertTrue(types.contains("MC") || types.contains("TE") || types.contains("TF"));
101102

102-
ArrayList<String> userAnswers = new ArrayList<>();
103+
List<String> userAnswers = new ArrayList<>();
103104
for (int i = 0; i < 12; i++) {
104105
userAnswers.add("incorrect answer");
105106
}

0 commit comments

Comments
 (0)