View Javadoc

1   package org.kuali.student.lum.statement.config.context;
2   
3   import java.util.ArrayList;
4   import java.util.List;
5   import java.util.Map;
6   
7   import org.junit.Assert;
8   import org.junit.Before;
9   import org.junit.Test;
10  import org.kuali.student.r2.common.exceptions.OperationFailedException;
11  import org.kuali.student.r1.core.statement.dto.ReqCompFieldInfo;
12  import org.kuali.student.r1.core.statement.dto.ReqComponentInfo;
13  import org.kuali.student.r1.lum.statement.typekey.ReqComponentFieldTypes;
14  import org.kuali.student.r2.lum.statement.config.context.PersonContextImpl;
15  
16  public class PersonContextImplTest {
17  
18  	private PersonContextImpl personContext = new PersonContextImpl();
19  
20  	private ReqComponentInfo reqComponent1;
21  	
22  	private void setupReqComponent1() {
23  		reqComponent1 = new ReqComponentInfo();
24          List<ReqCompFieldInfo> reqCompFieldList = new ArrayList<ReqCompFieldInfo>();
25          ReqCompFieldInfo reqCompField1 = new ReqCompFieldInfo();
26          reqCompField1.setType(ReqComponentFieldTypes.PERSON_KEY.getId());
27          reqCompField1.setValue("1234567890");
28          reqCompFieldList.add(reqCompField1);
29  		reqComponent1.setReqCompFields(reqCompFieldList);
30  	}
31  
32  	@Before
33  	public void beforeMethod() {
34  		setupReqComponent1();
35  	}
36  
37  	@Test
38      public void testCreateContextMap() throws OperationFailedException {
39  		Map<String, Object> contextMap = personContext.createContextMap(reqComponent1, new org.kuali.student.r2.common.dto.ContextInfo());
40  
41  		Assert.assertNotNull(contextMap);
42  		Assert.assertEquals("1234567890", contextMap.get(PersonContextImpl.PERSON_TOKEN));
43  	}
44  }