7
7
import java .io .IOException ;
8
8
import java .util .ArrayList ;
9
9
10
+ /**
11
+ * This class contains various test cases for the quiz use case.
12
+ * @author Anthony
13
+ */
10
14
public class QuizUseCaseTest {
11
15
QuizController controller ;
12
16
17
+ /**
18
+ * This method sets up my tests.
19
+ * @param numQuestions the number of questions
20
+ * @param timerOn is the timer on
21
+ * @param multipleChoiceOn is the multiple choice on
22
+ * @param textEntryOn is the text entry on
23
+ * @param trueFalseOn is the true false on
24
+ * @return the quiz settings request model
25
+ * @throws IOException if I can't access the test data
26
+ */
13
27
QuizSettingsRequestModel setup (int numQuestions ,
14
28
boolean timerOn ,
15
29
boolean multipleChoiceOn ,
@@ -32,6 +46,10 @@ QuizSettingsRequestModel setup(int numQuestions,
32
46
0 , multipleChoiceOn , textEntryOn , trueFalseOn , 0 );
33
47
}
34
48
49
+ /**
50
+ * Tests the quiz use case when only multiple choice questions are enabled.
51
+ * @throws IOException if I can't access the test data
52
+ */
35
53
@ Test
36
54
void testOnlyMultipleChoice () throws IOException {
37
55
QuizSettingsRequestModel quizSettingsRequestModel = this .setup (10 , false ,
@@ -62,6 +80,10 @@ void testOnlyMultipleChoice() throws IOException {
62
80
assertEquals (10 , quizResponseModel .getNumQuestions ());
63
81
}
64
82
83
+ /**
84
+ * Tests the quiz use case when all question types are enabled.
85
+ * @throws IOException if I can't access the test data
86
+ */
65
87
@ Test
66
88
void testAllOptionsEnabled () throws IOException {
67
89
QuizSettingsRequestModel quizSettingsRequestModel = this .setup (12 , false ,
@@ -90,6 +112,10 @@ void testAllOptionsEnabled() throws IOException {
90
112
assertEquals (12 , quizResponseModel .getNumQuestions ());
91
113
}
92
114
115
+ /**
116
+ * Tests the quiz use case when no question types are enabled.
117
+ * @throws IOException if I can't access the test data
118
+ */
93
119
@ Test
94
120
void testNoOptionsEnabled () throws IOException {
95
121
QuizSettingsRequestModel quizSettingsRequestModel = this .setup (12 , false ,
@@ -99,6 +125,10 @@ void testNoOptionsEnabled() throws IOException {
99
125
assertTrue (quizSettingsResponseModel .isFailed ());
100
126
}
101
127
128
+ /**
129
+ * Tests the quiz use case when the timer is set to a ridiculous value.
130
+ * @throws IOException if I can't access the test data
131
+ */
102
132
@ Test
103
133
void testRidiculousTimer () throws IOException {
104
134
QuizSettingsRequestModel quizSettingsRequestModel = this .setup (12 , true ,
0 commit comments