1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.lum.statement.service.impl;
17
18 import static org.junit.Assert.assertEquals;
19
20 import org.junit.BeforeClass;
21 import org.junit.Ignore;
22 import org.junit.Test;
23 import org.junit.runner.RunWith;
24 import org.kuali.student.r2.common.exceptions.DoesNotExistException;
25 import org.kuali.student.r2.common.exceptions.InvalidParameterException;
26 import org.kuali.student.r2.common.exceptions.MissingParameterException;
27 import org.kuali.student.r2.common.exceptions.OperationFailedException;
28 import org.kuali.student.r1.core.statement.service.StatementService;
29 import org.springframework.beans.factory.annotation.Autowired;
30 import org.springframework.test.context.ContextConfiguration;
31 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
32
33 @RunWith(SpringJUnit4ClassRunner.class)
34 @ContextConfiguration(locations={"classpath:statement-additional-context.xml"})
35 public class TestStatementServiceImplForProgram {
36
37 @Autowired
38 public StatementService statementService;
39
40 @BeforeClass
41 public static void beforeClass() {
42 }
43
44
45
46
47 @Test
48 public void testTranslateReqComponent_Completed1ofProgram() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
49 String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-NL-101", "KUALI.RULE", "en");
50 assertEquals("Must have successfully completed a minimum of 1 program from (Sociology, Geology) programs", nl);
51 }
52
53
54
55
56 @Test
57 public void testTranslateReqComponent_Completed2ofProgram() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
58 String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-NL-105", "KUALI.RULE", "en");
59 assertEquals("Must have successfully completed a minimum of 2 programs from (Sociology, Geology) programs", nl);
60 }
61
62
63
64
65 @Test
66 public void testTranslateReqComponent_NotCompletedAnyOfProgram() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
67 String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-NL-102", "KUALI.RULE", "en");
68 assertEquals("Must not have successfully completed any of (Sociology, Geology) programs", nl);
69 }
70
71
72
73
74 @Test
75 public void testTranslateReqComponent_NotCompletedProgram() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
76 String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-NL-108", "KUALI.RULE", "en");
77 assertEquals("Must not have successfully completed Sociology program", nl);
78 }
79
80
81
82
83 @Test
84 public void testTranslateReqComponent_CompletedAllProgram() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
85 String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-NL-103", "KUALI.RULE", "en");
86 assertEquals("Must have successfully completed all of (Sociology, Geology) programs", nl);
87 }
88
89
90
91
92 @Test
93 public void testTranslateReqComponent_CompletedSingleProgram() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
94 String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-NL-107", "KUALI.RULE", "en");
95 assertEquals("Must have successfully completed Sociology program", nl);
96 }
97
98
99
100
101 @Test
102 public void testTranslateReqComponent_1CourseCompletedFromPrograms() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
103 String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-NL-104", "KUALI.RULE", "en");
104 assertEquals("Must have successfully completed a minimum of 1 course from (Sociology, Geology) programs", nl);
105 }
106
107
108
109
110 @Test
111 public void testTranslateReqComponent_2CourseCompletedFromPrograms() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
112 String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-NL-106", "KUALI.RULE", "en");
113 assertEquals("Must have successfully completed a minimum of 2 courses from (Sociology, Geology) programs", nl);
114 }
115
116
117
118
119 @Test
120 public void testTranslateReqComponent_2CourseCompletedFrom1Program() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
121 String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-NL-109", "KUALI.RULE", "en");
122 assertEquals("Must have successfully completed a minimum of 2 courses from Sociology program", nl);
123 }
124
125
126
127
128 @Test
129 public void testTranslateReqComponent_admittedCreditsProgram() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
130 String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-NL-110", "KUALI.RULE", "en");
131 assertEquals("Must be admitted to program prior to earning 5 credits", nl);
132 }
133
134
135
136
137 @Test
138 public void testTranslateReqComponent_minTotalCredits_1Credit() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
139 String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-NL-111", "KUALI.RULE", "en");
140 assertEquals("Must have earned a minimum of 1 total credit", nl);
141 }
142
143
144
145
146 @Test
147 public void testTranslateReqComponent_minTotalCredits_120Credits() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
148 String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-NL-112", "KUALI.RULE", "en");
149 assertEquals("Must have earned a minimum of 120 total credits", nl);
150 }
151
152
153
154
155 @Test
156 public void testTranslateReqComponent_maxTotalCredits_130Credits() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
157 String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-NL-113", "KUALI.RULE", "en");
158 assertEquals("Must not have earned more than 130 credits", nl);
159 }
160
161
162
163
164 @Test
165 public void testTranslateReqComponent_CompletionDuration_10Credits() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
166 String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-NL-114", "KUALI.RULE", "en");
167 assertEquals("Must not exceed 10 semesters without completing program", nl);
168 }
169
170
171
172
173 @Test
174 public void testTranslateReqComponent_CandidateStatusDuration_3Credits() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
175 String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-NL-115", "KUALI.RULE", "en");
176 assertEquals("Must attain candidate status within 3 semesters after program entry term", nl);
177 }
178
179
180
181
182 @Test
183 public void testTranslateReqComponent_CompletionDurationAfterEntry_3Credits() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
184 String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-NL-116", "KUALI.RULE", "en");
185 assertEquals("Must complete program within 10 semesters after program entry term", nl);
186 }
187
188
189
190
191 @Test
192 public void testTranslateStatementTree() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
193 String nl = statementService.getNaturalLanguageForStatement("STMT-TV-1", "KUALI.RULE", "en");
194 assertEquals("Must have successfully completed all courses from (MATH152, MATH180) " +
195 "and Must have earned a minimum GPA of 3.5 in (MATH152, MATH180) " +
196 "and (Must have successfully completed a minimum of 1 course from (MATH152, MATH180) " +
197 "or Permission of instructor required)", nl);
198 }
199
200
201
202
203 @Test
204 public void testTranslateReqComponent_kuali_reqComponent_type_program_residence_credits_final() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
205 String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-NL-117", "KUALI.RULE", "en");
206 assertEquals("Sociology students must take their final 30 credits in residence", nl);
207 }
208
209
210
211
212 @Test
213 public void testTranslateReqComponent_kuali_reqComponent_type_program_enrolled_credits_final() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
214 String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-NL-118", "KUALI.RULE", "en");
215 assertEquals("Sociology students must be enrolled in their graduation major for the final 30 credits taken", nl);
216 }
217
218
219
220
221 @Test
222 public void testTranslateReqComponent_kuali_reqComponent_type_program_minors_nof() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
223 String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-NL-119", "KUALI.RULE", "en");
224 assertEquals("Must earn no more than 2 minors as part of a program", nl);
225 }
226
227
228
229
230 @Test
231 public void testTranslateReqComponent_kuali_reqComponent_type_program_minor_admitted_classstanding() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
232 String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-NL-120", "KUALI.RULE", "en");
233 assertEquals("Must be admitted to a minor program only if they have junior or senior class standing", nl);
234 }
235
236
237
238
239 @Test
240 public void testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_course_courseset_completed_max() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
241
242 String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-NL-121", "KUALI.RULE", "en");
243 assertEquals("Must have successfully completed no more than 2 courses from (MATH152, MATH180)", nl);
244 }
245
246
247
248
249 @Test
250 public void testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_program_cumulative_gpa_min() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
251
252 String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-NL-122", "KUALI.RULE", "en");
253 assertEquals("Must have earned a minimum cumulative GPA of 2.5", nl);
254 }
255
256
257
258
259 @Test
260 public void testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_program_duration_gpa_min() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
261
262 String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-NL-123", "KUALI.RULE", "en");
263 assertEquals("Must have earned a minimum semester GPA of 3.0", nl);
264 }
265 }