001    package org.kuali.student.lum.statement.config.context;
002    
003    import java.util.ArrayList;
004    import java.util.List;
005    import java.util.Map;
006    
007    import org.junit.Assert;
008    import org.junit.Before;
009    import org.junit.Test;
010    import org.kuali.student.r2.common.exceptions.OperationFailedException;
011    import org.kuali.student.r1.core.statement.dto.ReqCompFieldInfo;
012    import org.kuali.student.r1.core.statement.dto.ReqComponentInfo;
013    import org.kuali.student.r1.lum.statement.typekey.ReqComponentFieldTypes;
014    import org.kuali.student.r2.lum.statement.config.context.PersonContextImpl;
015    
016    public class PersonContextImplTest {
017    
018            private PersonContextImpl personContext = new PersonContextImpl();
019    
020            private ReqComponentInfo reqComponent1;
021            
022            private void setupReqComponent1() {
023                    reqComponent1 = new ReqComponentInfo();
024            List<ReqCompFieldInfo> reqCompFieldList = new ArrayList<ReqCompFieldInfo>();
025            ReqCompFieldInfo reqCompField1 = new ReqCompFieldInfo();
026            reqCompField1.setType(ReqComponentFieldTypes.PERSON_KEY.getId());
027            reqCompField1.setValue("1234567890");
028            reqCompFieldList.add(reqCompField1);
029                    reqComponent1.setReqCompFields(reqCompFieldList);
030            }
031    
032            @Before
033            public void beforeMethod() {
034                    setupReqComponent1();
035            }
036    
037            @Test
038        public void testCreateContextMap() throws OperationFailedException {
039                    Map<String, Object> contextMap = personContext.createContextMap(reqComponent1, new org.kuali.student.r2.common.dto.ContextInfo());
040    
041                    Assert.assertNotNull(contextMap);
042                    Assert.assertEquals("1234567890", contextMap.get(PersonContextImpl.PERSON_TOKEN));
043            }
044    }