001/**
002 * Copyright 2010 The Kuali Foundation Licensed under the
003 * Educational Community License, Version 2.0 (the "License"); you may
004 * not use this file except in compliance with the License. You may
005 * obtain a copy of the License at
006 *
007 * http://www.osedu.org/licenses/ECL-2.0
008 *
009 * Unless required by applicable law or agreed to in writing,
010 * software distributed under the License is distributed on an "AS IS"
011 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
012 * or implied. See the License for the specific language governing
013 * permissions and limitations under the License.
014 */
015
016package org.kuali.student.lum.statement.service.impl;
017
018import static org.junit.Assert.assertEquals;
019
020import org.junit.BeforeClass;
021import org.junit.Ignore;
022import org.junit.Test;
023import org.junit.runner.RunWith;
024import org.kuali.student.r2.common.exceptions.DoesNotExistException;
025import org.kuali.student.r2.common.exceptions.InvalidParameterException;
026import org.kuali.student.r2.common.exceptions.MissingParameterException;
027import org.kuali.student.r2.common.exceptions.OperationFailedException;
028import org.kuali.student.r1.core.statement.service.StatementService;
029import org.springframework.beans.factory.annotation.Autowired;
030import org.springframework.test.context.ContextConfiguration;
031import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
032
033@RunWith(SpringJUnit4ClassRunner.class)
034@ContextConfiguration(locations={"classpath:statement-additional-context.xml"})
035public class TestStatementServiceImplForCourse {
036
037        @Autowired
038    public StatementService statementService;
039
040        @BeforeClass
041        public static void beforeClass() {
042        }
043
044//    @Test
045//    public void hello()
046//    {
047//
048//    }
049
050    @Test
051    public void testGetNaturalLanguageForReqComponent_DefaultEnglish() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
052        //req. type: 'kuali.reqComponent.type.course.courseset.completed.none'
053        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-1", "KUALI.RULE", null);
054        assertEquals("Must not have successfully completed MATH152", nl);
055    }
056
057    @Test
058    public void testGetNaturalLanguageForReqComponent_none1() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
059        //req. type: 'kuali.reqComponent.type.course.courseset.completed.none'
060        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-1", "KUALI.RULE", "en");
061        assertEquals("Must not have successfully completed MATH152", nl);
062    }
063
064    @Test
065    public void testGetNaturalLanguageForReqComponent_noneN() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
066        //req. type: 'kuali.reqComponent.type.course.courseset.completed.none'
067        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-2", "KUALI.RULE", "en");
068        assertEquals("Must not have successfully completed any courses from (MATH152, MATH180)", nl);
069    }
070
071    @Test
072    public void testGetNaturalLanguageForReqComponent_all1() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
073        //req. type: 'kuali.reqComponent.type.course.courseset.completed.all'
074        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-3", "KUALI.RULE", "en");
075        assertEquals("Must have successfully completed MATH152", nl);
076    }
077
078    @Test
079    public void testGetNaturalLanguageForReqComponent_allN() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
080        //req. type: 'kuali.reqComponent.type.course.courseset.completed.all'
081        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-4", "KUALI.RULE", "en");
082        assertEquals("Must have successfully completed all courses from (MATH152, MATH180)", nl);
083    }
084
085    @Test
086    public void testGetNaturalLanguageForReqComponent_1of1() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
087        //req. type: 'kuali.reqComponent.type.course.courseset.completed.nof '
088        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-5", "KUALI.RULE", "en");
089        assertEquals("Must have successfully completed MATH152", nl);
090    }
091
092        @Test
093        public void testGetNaturalLanguageForReqComponent_1ofN() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
094            //req. type: 'kuali.reqComponent.type.course.courseset.completed.nof '
095                String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-6", "KUALI.RULE", "en");
096        assertEquals("Must have successfully completed a minimum of 1 course from (MATH152, MATH180)", nl);
097        }
098
099    @Test
100    public void testGetNaturalLanguageForReqComponent_2ofN() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
101        //req. type: 'kuali.reqComponent.type.course.courseset.completed.nof '
102        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-7", "KUALI.RULE", "en");
103        assertEquals("Must have successfully completed a minimum of 2 courses from (MATH152, MATH180)", nl);
104    }
105
106    @Test
107    public void testGetNaturalLanguageForReqComponent_enroll_1ofN() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
108        //req. type: 'kuali.reqComponent.type.course.courseset.enrolled.nof'
109        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-8", "KUALI.RULE", "en");
110        assertEquals("Must be concurrently enrolled in a minimum of 1 course from (MATH152, MATH180)", nl);
111    }
112
113    @Test
114    public void testGetNaturalLanguageForReqComponent_enroll_2ofN() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
115        //req. type: 'kuali.reqComponent.type.course.courseset.enrolled.nof'
116        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-9", "KUALI.RULE", "en");
117        assertEquals("Must be concurrently enrolled in a minimum of 2 courses from (MATH152, MATH180)", nl);
118    }
119
120    @Test
121    public void testGetNaturalLanguageForReqComponent_credits_1ofN() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
122        //req. type: 'kuali.reqComponent.type.course.courseset.credits.completed.nof'
123        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-10", "KUALI.RULE", "en");
124        assertEquals("Must have successfully completed a minimum of 1 credit from (MATH152, MATH180)", nl);
125    }
126
127    @Test
128    public void testGetNaturalLanguageForReqComponent_credits_2ofN() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
129        //req. type: 'kuali.reqComponent.type.course.courseset.credits.completed.nof'
130        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-11", "KUALI.RULE", "en");
131        assertEquals("Must have successfully completed a minimum of 2 credits from (MATH152, MATH180)", nl);
132    }
133
134    @Test
135    public void testGetNaturalLanguageForReqComponent_credits_none() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
136        //req. type: 'kuali.reqComponent.type.course.courseset.credits.completed.none'
137        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-12", "KUALI.RULE", "en");
138        assertEquals("Must not have successfully completed any credits from (MATH152, MATH180)", nl);
139    }
140
141    @Test
142    public void testGetNaturalLanguageForReqComponent_credits_max1() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
143        //req. type: 'kuali.reqComponent.type.course.courseset.credits.completed.max'
144        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-13", "KUALI.RULE", "en");
145        assertEquals("Must successfully complete no more than 1 credit from (MATH152, MATH180)", nl);
146    }
147
148    @Test
149    public void testGetNaturalLanguageForReqComponent_credits_max2() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
150        //req. type: 'kuali.reqComponent.type.course.courseset.credits.completed.max'
151        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-14", "KUALI.RULE", "en");
152        assertEquals("Must successfully complete no more than 2 credits from (MATH152, MATH180)", nl);
153    }
154
155    @Test
156    public void testGetNaturalLanguageForReqComponent_gradecheck() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
157        //req. type: 'kuali.reqComponent.type.course.courseset.gpa.min'
158        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-15", "KUALI.RULE", "en");
159        assertEquals("Must have earned a minimum GPA of 3.5 in (MATH152, MATH180)", nl);
160    }
161
162    @Test
163    public void testGetNaturalLanguageForReqComponent_grade_min_GradeType_Letter() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
164        //req. type: 'kuali.reqComponent.type.course.courseset.grade.min'
165        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-16a", "KUALI.RULE", "en");
166        assertEquals("Must have earned a minimum grade of letter B in (MATH152, MATH180)", nl);
167    }
168
169    @Test
170    public void testGetNaturalLanguageForReqComponent_grade_min_GradeType_Percentage() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
171        //req. type: 'kuali.reqComponent.type.course.courseset.grade.min'
172        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-16b", "KUALI.RULE", "en");
173        assertEquals("Must have earned a minimum grade of percentage 70-79% in (MATH152, MATH180)", nl);
174    }
175
176    @Test
177    public void testGetNaturalLanguageForReqComponent_grade_min_GradeType_PassFail() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
178        //req. type: 'kuali.reqComponent.type.course.courseset.grade.min'
179        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-16c", "KUALI.RULE", "en");
180        assertEquals("Must have earned a minimum grade of Pass in (MATH152, MATH180)", nl);
181    }
182
183    @Test
184    public void testGetNaturalLanguageForReqComponent_grade_min_GradeType_CompletedNotation() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
185        //req. type: 'kuali.reqComponent.type.course.courseset.grade.min'
186        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-16d", "KUALI.RULE", "en");
187        assertEquals("Must have earned a minimum grade of In-Progress in (MATH152, MATH180)", nl);
188    }
189
190    @Test
191    public void testGetNaturalLanguageForReqComponent_grade_min_GradeType_Satisfactory() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
192        //req. type: 'kuali.reqComponent.type.course.courseset.grade.min'
193        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-16e", "KUALI.RULE", "en");
194        assertEquals("Must have earned a minimum grade of Satisfactory in (MATH152, MATH180)", nl);
195    }
196
197    @Test
198    public void testGetNaturalLanguageForReqComponent_grade_max_GradeType_Letter() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
199        //req. type: 'kuali.reqComponent.type.course.courseset.grade.max'
200        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-17a", "KUALI.RULE", "en");
201        assertEquals("Must not have earned a maximum grade of letter C or higher in (MATH152, MATH180)", nl);
202    }
203
204    @Test
205    public void testGetNaturalLanguageForReqComponent_grade_max_GradeType_CompletedNotation() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
206        //req. type: 'kuali.reqComponent.type.course.courseset.grade.max'
207        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-17b", "KUALI.RULE", "en");
208        assertEquals("Must not have earned a maximum grade of Not-Satisfactory or higher in (MATH152, MATH180)", nl);
209    }
210
211    @Test
212    public void testGetNaturalLanguageForReqComponent_perm_org() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
213        //req. type: 'kuali.reqComponent.type.course.permission.org.required'
214        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-18", "KUALI.RULE", "en");
215        assertEquals("Permission of English Dept required", nl);
216    }
217
218    @Test
219    public void testGetNaturalLanguageForReqComponent_perm_instructor() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
220        //req. type: 'kuali.reqComponent.type.course.permission.instructor.required'
221        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-19", "KUALI.RULE", "en");
222        assertEquals("Permission of instructor required", nl);
223    }
224
225    @Test
226    public void testGetNaturalLanguageForReqComponent_allN_CluSetOfClusets() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
227        //req. type: 'kuali.reqComponent.type.course.courseset.completed.all'
228        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-20", "KUALI.RULE", "en");
229        assertEquals("Must have successfully completed all courses from (MATH152, MATH221, MATH180, MATH200, MATH215)", nl);
230    }
231
232    @Test
233    public void testGetNaturalLanguageForReqComponent_MinTestScoreOnTest() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
234        //req. type: 'kuali.reqComponent.type.course.test.score.min'
235        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-21", "KUALI.RULE", "en");
236        assertEquals("Must have achieved a minimum score of 600 on SAT Critical Reading Exam", nl);
237    }
238
239    @Test
240    public void testGetNaturalLanguageForReqComponent_MaxTestScoreOnTest() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
241        //req. type: 'kuali.reqComponent.type.course.test.score.max'
242        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-22", "KUALI.RULE", "en");
243        assertEquals("Must have achieved a score no higher than 900 on SAT Critical Reading Exam", nl);
244    }
245
246    @Test
247    public void testGetNaturalLanguageForReqComponent_MinCoursesMinGradeTest_GradeType_Letter() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
248        //req. type: 'kuali.reqComponent.type.course.courseset.nof.grade.min'
249        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-23a", "KUALI.RULE", "en");
250        assertEquals("Must successfully complete a minimum of 1 course with a minimum grade of letter B from (MATH152, MATH180)", nl);
251    }
252
253    @Test
254    public void testGetNaturalLanguageForReqComponent_MinCoursesMinGradeTest_GradeType_CompletedNotation() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
255        //req. type: 'kuali.reqComponent.type.course.courseset.nof.grade.min'
256        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-23b", "KUALI.RULE", "en");
257        assertEquals("Must successfully complete a minimum of 1 course with a minimum grade of Completed from (MATH152, MATH180)", nl);
258    }
259
260    @Test
261    public void testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_course_program_admitted_org_duration_ProgramAsClu() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
262        //req. type: 'kuali.reqComponent.type.course.program.admitted.org.duration'
263        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-24a", "KUALI.RULE", "en");
264        assertEquals("Students admitted to Sociology may take no more than 2 courses in the English Dept in 1 year", nl);
265    }
266
267    @Test
268    public void testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_course_program_admitted_org_duration_ProgramAsCluSet() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
269        //req. type: 'kuali.reqComponent.type.course.program.admitted.org.duration'
270        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-24b", "KUALI.RULE", "en");
271        assertEquals("Students admitted to Sociology may take no more than 2 courses in the English Dept in 1 year", nl);
272    }
273
274    @Test
275    public void testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_course_program_notadmitted_org_duration_ProgramAsClu() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
276        //req. type: 'kuali.reqComponent.type.course.program.notadmitted.org.duration'
277        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-25a", "KUALI.RULE", "en");
278        assertEquals("Students not admitted to Sociology may take no more than 3 courses in the Computer Science Dept in 1 year", nl);
279    }
280
281    @Test
282    public void testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_course_program_notadmitted_org_duration_ProgramAsCluSet() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
283        //req. type: 'kuali.reqComponent.type.course.program.notadmitted.org.duration'
284        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-25b", "KUALI.RULE", "en");
285        assertEquals("Students not admitted to Sociology may take no more than 3 courses in the Computer Science Dept in 1 year", nl);
286    }
287
288    @Test
289    public void testGetNaturalLanguageForReqComponent_kuali_reqComponent_type_course_org_program_admitted() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
290        //req. type: 'kuali.reqComponent.type.course.org.program.admitted'
291        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-26", "KUALI.RULE", "en");
292        assertEquals("Must be admitted to any program offered at the course campus location", nl);
293    }
294
295    @Test
296    public void testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_course_program_notadmitted_ProgramAsClu() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
297        //req. type: 'kuali.reqComponent.type.course.program.notadmitted'
298        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-27a", "KUALI.RULE", "en");
299        assertEquals("Must not have been admitted to the Sociology program", nl);
300    }
301
302    @Test
303    public void testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_course_program_notadmitted_ProgramAsCluSet() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
304        //req. type: 'kuali.reqComponent.type.course.program.notadmitted'
305        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-27b", "KUALI.RULE", "en");
306        assertEquals("Must not have been admitted to the Sociology program", nl);
307    }
308
309    @Test
310    public void testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_course_credits_repeat_max() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
311        //req. type: 'kuali.reqComponent.type.course.credits.repeat.max'
312        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-28", "KUALI.RULE", "en");
313        assertEquals("May be repeated for a maximum of 6 credits", nl);
314    }
315
316    @Test
317    public void testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_course_org_credits_completed_min() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
318        //req. type: 'kuali.reqComponent.type.course.org.credits.completed.min'
319        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-29", "KUALI.RULE", "en");
320        assertEquals("Must have successfully completed a minimum of 30 credits from courses in the Computer Science Dept", nl);
321    }
322
323    @Test
324    public void testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_course_program_admitted_ProgramAsClu() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
325        //req. type: 'kuali.reqComponent.type.course.program.admitted'
326        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-30a", "KUALI.RULE", "en");
327        assertEquals("Must have been admitted to the Sociology program", nl);
328    }
329
330    @Test
331    public void testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_course_program_admitted_ProgramAsCluSet() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
332        //req. type: 'kuali.reqComponent.type.course.program.admitted'
333        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-30b", "KUALI.RULE", "en");
334        assertEquals("Must have been admitted to the Sociology program", nl);
335    }
336
337    @Test
338    public void testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_course_completed() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
339        //req. type: 'kuali.reqComponent.type.course.completed'
340        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-31", "KUALI.RULE", "en");
341        assertEquals("Must have successfully completed MATH152", nl);
342    }
343
344    @Test
345    public void testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_course_enrolled() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
346        //req. type: 'kuali.reqComponent.type.course.enrolled'
347        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-32", "KUALI.RULE", "en");
348        assertEquals("Must be concurrently enrolled in MATH152", nl);
349    }
350
351    @Test
352    public void testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_course_notcompleted() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
353        //req. type: 'kuali.reqComponent.type.course.notcompleted'
354        String nl = statementService.getNaturalLanguageForReqComponent("REQCOMP-33", "KUALI.RULE", "en");
355        assertEquals("Must not have successfully completed MATH152", nl);
356    }
357}