View Javadoc

1   /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
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  	 * Requirement component type: kuali.reqComponent.type.program.programset.completed.nof
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  	 * Requirement component type: kuali.reqComponent.type.program.programset.completed.nof
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  	 * Requirement component type: kuali.reqComponent.type.program.programset.notcompleted.nof
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  	 * Requirement component type: kuali.reqComponent.type.program.programset.notcompleted.nof
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  	 * Requirement component type: kuali.reqComponent.type.program.programset.completed.all
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  	 * Requirement component type: kuali.reqComponent.type.program.programset.completed.all
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  	 * Requirement component type: kuali.reqComponent.type.program.programset.coursecompleted.nof
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 	 * Requirement component type: kuali.reqComponent.type.program.programset.coursecompleted.nof
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 	 * Requirement component type: kuali.reqComponent.type.program.programset.coursecompleted.nof
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      * Requirement component type: kuali.reqComponent.type.program.admitted.credits
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      * Requirement component type: kuali.reqComponent.type.program.credits.min
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      * Requirement component type: kuali.reqComponent.type.program.credits.min
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      * Requirement component type: kuali.reqComponent.type.program.credits.max
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      * Requirement component type: kuali.reqComponent.type.program.completion.duration
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      * Requirement component type: kuali.reqComponent.type.program.candidate.status.duration
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      * Requirement component type: kuali.reqComponent.type.program.completion.duration.afterentry
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      * Statement type: kuali.statement.type.program.entrance 
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      * Requirement component type: kuali.reqComponent.type.program.residence.credits.final
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      * Requirement component type: kuali.reqComponent.type.program.enrolled.credits.final
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      * Requirement component type: kuali.reqComponent.type.program.minors.nof
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      * Requirement component type: kuali.reqComponent.type.program.minor.admitted.classstanding
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      * Requirement component type: kuali.reqComponent.type.course.courseset.completed.max
238      */
239     @Test
240     public void testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_course_courseset_completed_max() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
241         //req. type: 'kuali.reqComponent.type.course.courseset.completed.max'
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      * Requirement component type: kuali.reqComponent.type.program.cumulative.gpa.min
248      */
249     @Test
250     public void testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_program_cumulative_gpa_min() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
251         //req. type: 'kuali.reqComponent.type.program.cumulative.gpa.min'
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      * Requirement component type: kuali.reqComponent.type.program.duration.gpa.min
258      */
259     @Test
260     public void testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_program_duration_gpa_min() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
261         //req. type: 'kuali.reqComponent.type.program.duration.gpa.min'
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 }