View Javadoc

1   package org.kuali.student.krms.termresolver;
2   
3   import org.junit.Before;
4   import org.junit.Ignore;
5   import org.junit.Test;
6   import org.junit.runner.RunWith;
7   import org.kuali.rice.krms.impl.type.KrmsTypeResolver;
8   import org.kuali.student.common.util.krms.RulesExecutionConstants;
9   import org.kuali.student.enrollment.academicrecord.dto.StudentCourseRecordInfo;
10  import org.kuali.student.enrollment.academicrecord.service.AcademicRecordService;
11  import org.kuali.student.krms.util.KSKRMSExecutionConstants;
12  import org.kuali.student.r2.common.dto.ContextInfo;
13  import org.kuali.student.r2.common.dto.LocaleInfo;
14  import org.springframework.test.context.ContextConfiguration;
15  import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
16  
17  import javax.annotation.Resource;
18  import java.util.HashMap;
19  import java.util.List;
20  import java.util.Map;
21  
22  import static org.junit.Assert.assertNotNull;
23  
24  @RunWith(SpringJUnit4ClassRunner.class)
25  @ContextConfiguration(locations = {"classpath:ks-krms-test-context-mock.xml"})
26  @Ignore
27  public class TestCompletedCoursesTermResolver {
28  	private KrmsTypeResolver typeResolver;
29  
30      public ContextInfo callContext = null;
31      @Resource(name = "acadRecordService")
32      private AcademicRecordService academicRecordService;
33      private String studentID = "12020303";
34  
35      @Before
36      public void setUp() {
37          callContext = new ContextInfo();
38      }
39  
40  
41      @Test
42      public void testAcadRecordServiceNotNull() {
43          assertNotNull(academicRecordService);
44      }
45  
46      @Test
47      public void testResolve() {
48          CompletedCoursesTermResolver termResolver = new CompletedCoursesTermResolver();
49          termResolver.setAcademicRecordService(academicRecordService);
50          Map<String, Object> resolvedPrereqs = new HashMap<String, Object>();
51          Map<String, String> parameters = new HashMap<String, String>();
52  
53          ContextInfo context = new ContextInfo();
54          context.setLocale(new LocaleInfo());
55          context.setPrincipalId("nina");
56  
57          resolvedPrereqs.put(RulesExecutionConstants.CONTEXT_INFO_TERM_NAME, context);
58  
59          parameters.put(KSKRMSExecutionConstants.PERSON_ID_TERM_PROPERTY, studentID);
60          String personId = parameters.get(KSKRMSExecutionConstants.PERSON_ID_TERM_PROPERTY);
61  
62          List<StudentCourseRecordInfo> acadRecords = termResolver.resolve(resolvedPrereqs, parameters);
63          // TODO Do some assert statements on the expected returned list.
64          assertNotNull(acadRecords);
65  
66      }
67  
68  
69  
70  }
71