| 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.common.exceptions.OperationFailedException; | 
            
  
    | 11 |  | import org.kuali.student.core.statement.dto.ReqCompFieldInfo; | 
            
  
    | 12 |  | import org.kuali.student.core.statement.dto.ReqComponentInfo; | 
            
  
    | 13 |  | import org.kuali.student.lum.statement.typekey.ReqComponentFieldTypes; | 
            
  
    | 14 |  |  | 
               
        |  |  | 
           
           |  | 100% | Uncovered Elements: 0 (65) | Complexity: 9 | Complexity Density: 0.16 |  | 
  
  
    | 15 |  | public class BasicContextImplTest { | 
            
  
    | 16 |  | private BasicContextImpl basicContext = new BasicContextImpl(); | 
            
  
    | 17 |  | private ReqComponentInfo reqComponent1; | 
            
  
    | 18 |  | private ReqComponentInfo reqComponent2; | 
            
  
    | 19 |  | private ReqComponentInfo reqComponent3; | 
            
  
    | 20 |  | private ReqComponentInfo reqComponent4; | 
            
  
    | 21 |  |  | 
               
        |  |  | 
           
           |  | 100% | Uncovered Elements: 0 (11) | Complexity: 1 | Complexity Density: 0.09 |  | 
  
  
    | 22 | 4 |  private void setupReqComponent1() {... | 
            
  
    | 23 | 4 | reqComponent1 = new ReqComponentInfo(); | 
            
  
    | 24 | 4 | List<ReqCompFieldInfo> reqCompFieldList = new ArrayList<ReqCompFieldInfo>(); | 
            
  
    | 25 | 4 | ReqCompFieldInfo reqCompField1 = new ReqCompFieldInfo(); | 
            
  
    | 26 | 4 | reqCompField1.setType(ReqComponentFieldTypes.OPERATOR_KEY.getId()); | 
            
  
    | 27 | 4 | reqCompField1.setValue(">"); | 
            
  
    | 28 | 4 | reqCompFieldList.add(reqCompField1); | 
            
  
    | 29 | 4 | ReqCompFieldInfo reqCompField2 = new ReqCompFieldInfo(); | 
            
  
    | 30 | 4 | reqCompField2.setType(ReqComponentFieldTypes.INTEGER_VALUE1_KEY.getId()); | 
            
  
    | 31 | 4 | reqCompField2.setValue("1"); | 
            
  
    | 32 | 4 | reqCompFieldList.add(reqCompField2); | 
            
  
    | 33 | 4 | reqComponent1.setReqCompFields(reqCompFieldList); | 
            
  
    | 34 |  | } | 
            
  
    | 35 |  |  | 
               
        |  |  | 
           
           |  | 100% | Uncovered Elements: 0 (7) | Complexity: 1 | Complexity Density: 0.14 |  | 
  
  
    | 36 | 4 |  private void setupReqComponent2() {... | 
            
  
    | 37 | 4 | reqComponent2 = new ReqComponentInfo(); | 
            
  
    | 38 | 4 | List<ReqCompFieldInfo> reqCompFieldList = new ArrayList<ReqCompFieldInfo>(); | 
            
  
    | 39 | 4 | ReqCompFieldInfo reqCompField1 = new ReqCompFieldInfo(); | 
            
  
    | 40 | 4 | reqCompField1.setType(ReqComponentFieldTypes.INTEGER_VALUE1_KEY.getId()); | 
            
  
    | 41 | 4 | reqCompField1.setValue("1"); | 
            
  
    | 42 | 4 | reqCompFieldList.add(reqCompField1); | 
            
  
    | 43 | 4 | reqComponent2.setReqCompFields(reqCompFieldList); | 
            
  
    | 44 |  | } | 
            
  
    | 45 |  |  | 
               
        |  |  | 
           
           |  | 100% | Uncovered Elements: 0 (7) | Complexity: 1 | Complexity Density: 0.14 |  | 
  
  
    | 46 | 4 |  private void setupReqComponent3() {... | 
            
  
    | 47 | 4 | reqComponent3 = new ReqComponentInfo(); | 
            
  
    | 48 | 4 | List<ReqCompFieldInfo> reqCompFieldList = new ArrayList<ReqCompFieldInfo>(); | 
            
  
    | 49 | 4 | ReqCompFieldInfo reqCompField1 = new ReqCompFieldInfo(); | 
            
  
    | 50 | 4 | reqCompField1.setType(ReqComponentFieldTypes.INTEGER_VALUE1_KEY.getId()); | 
            
  
    | 51 | 4 | reqCompField1.setValue(null); | 
            
  
    | 52 | 4 | reqCompFieldList.add(reqCompField1); | 
            
  
    | 53 | 4 | reqComponent3.setReqCompFields(reqCompFieldList); | 
            
  
    | 54 |  | } | 
            
  
    | 55 |  |  | 
               
        |  |  | 
           
           |  | 100% | Uncovered Elements: 0 (11) | Complexity: 1 | Complexity Density: 0.09 |  | 
  
  
    | 56 | 4 |  private void setupReqComponent4() {... | 
            
  
    | 57 | 4 | reqComponent4 = new ReqComponentInfo(); | 
            
  
    | 58 | 4 | List<ReqCompFieldInfo> reqCompFieldList = new ArrayList<ReqCompFieldInfo>(); | 
            
  
    | 59 | 4 | ReqCompFieldInfo reqCompField1 = new ReqCompFieldInfo(); | 
            
  
    | 60 | 4 | reqCompField1.setType(ReqComponentFieldTypes.OPERATOR_KEY.getId()); | 
            
  
    | 61 | 4 | reqCompField1.setValue(null); | 
            
  
    | 62 | 4 | reqCompFieldList.add(reqCompField1); | 
            
  
    | 63 | 4 | ReqCompFieldInfo reqCompField2 = new ReqCompFieldInfo(); | 
            
  
    | 64 | 4 | reqCompField2.setType(ReqComponentFieldTypes.INTEGER_VALUE1_KEY.getId()); | 
            
  
    | 65 | 4 | reqCompField2.setValue(null); | 
            
  
    | 66 | 4 | reqCompFieldList.add(reqCompField2); | 
            
  
    | 67 | 4 | reqComponent4.setReqCompFields(reqCompFieldList); | 
            
  
    | 68 |  | } | 
            
  
    | 69 |  |  | 
               
        |  |  | 
           
           |  | 100% | Uncovered Elements: 0 (4) | Complexity: 1 | Complexity Density: 0.25 |  | 
  
  
    | 70 | 4 |  @Before... | 
            
  
    | 71 |  | public void beforeMethod() { | 
            
  
    | 72 | 4 | setupReqComponent1(); | 
            
  
    | 73 | 4 | setupReqComponent2(); | 
            
  
    | 74 | 4 | setupReqComponent3(); | 
            
  
    | 75 | 4 | setupReqComponent4(); | 
            
  
    | 76 |  | } | 
            
  
    | 77 |  |  | 
               
        |  |  | 
           
           |  | 100% | Uncovered Elements: 0 (5) | Complexity: 1 | Complexity Density: 0.2 | 1
    PASS |  | 
  
  
    | 78 | 1 |  @Test... | 
            
  
    | 79 |  | public void testCreateContextMap() throws OperationFailedException { | 
            
  
    | 80 | 1 | Map<String, Object> contextMap = basicContext.createContextMap(reqComponent1); | 
            
  
    | 81 | 1 | Assert.assertNotNull(contextMap); | 
            
  
    | 82 | 1 | Assert.assertTrue(contextMap.containsKey(BasicContextImpl.NL_HELPER_TOKEN)); | 
            
  
    | 83 | 1 | Assert.assertTrue(contextMap.containsKey(BasicContextImpl.OPERATOR_TOKEN)); | 
            
  
    | 84 | 1 | Assert.assertTrue(contextMap.containsKey(BasicContextImpl.INTEGER_VALUE_TOKEN)); | 
            
  
    | 85 |  | } | 
            
  
    | 86 |  |  | 
               
        |  |  | 
           
           |  | 100% | Uncovered Elements: 0 (4) | Complexity: 1 | Complexity Density: 0.25 | 1
    PASS |  | 
  
  
    | 87 | 1 |  @Test... | 
            
  
    | 88 |  | public void testCreateContextMap_NullTokenValues() throws OperationFailedException { | 
            
  
    | 89 | 1 | Map<String, Object> contextMap = basicContext.createContextMap(reqComponent4); | 
            
  
    | 90 | 1 | Assert.assertNotNull(contextMap); | 
            
  
    | 91 | 1 | Assert.assertFalse(contextMap.containsKey(BasicContextImpl.OPERATOR_TOKEN)); | 
            
  
    | 92 | 1 | Assert.assertFalse(contextMap.containsKey(BasicContextImpl.INTEGER_VALUE_TOKEN)); | 
            
  
    | 93 |  | } | 
            
  
    | 94 |  |  | 
               
        |  |  | 
           
           |  | 100% | Uncovered Elements: 0 (4) | Complexity: 1 | Complexity Density: 0.25 | 1
    PASS |  | 
  
  
    | 95 | 1 |  @Test... | 
            
  
    | 96 |  | public void testCreateContextMap_CheckTokenValueDataType_Integer() throws OperationFailedException { | 
            
  
    | 97 | 1 | Map<String, Object> contextMap = basicContext.createContextMap(reqComponent2); | 
            
  
    | 98 | 1 | Object value = contextMap.get(BasicContextImpl.INTEGER_VALUE_TOKEN); | 
            
  
    | 99 |  |  | 
            
  
    | 100 | 1 | Assert.assertEquals(Integer.class.getName(), value.getClass().getName()); | 
            
  
    | 101 | 1 | Assert.assertEquals("1", value.toString()); | 
            
  
    | 102 |  | } | 
            
  
    | 103 |  |  | 
               
        |  |  | 
           
           |  | 100% | Uncovered Elements: 0 (3) | Complexity: 1 | Complexity Density: 0.33 | 1
    PASS |  | 
  
  
    | 104 | 1 |  @Test... | 
            
  
    | 105 |  | public void testCreateContextMap_CheckTokenValueDataType_NullInteger() throws OperationFailedException { | 
            
  
    | 106 | 1 | Map<String, Object> contextMap = basicContext.createContextMap(reqComponent3); | 
            
  
    | 107 | 1 | Object value = contextMap.get(BasicContextImpl.INTEGER_VALUE_TOKEN); | 
            
  
    | 108 |  |  | 
            
  
    | 109 | 1 | Assert.assertEquals(null, value); | 
            
  
    | 110 |  | } | 
            
  
    | 111 |  | } |