Clover Coverage Report - KS LUM 1.1.0-M10-SNAPSHOT (Aggregated)
Coverage timestamp: Fri Dec 17 2010 06:40:47 EST
22   59   5   4.4
0   51   0.23   5
5     1  
1    
 
  GpaContextImplTest       Line # 15 22 0% 5 0 100% 1.0
 
  (2)
 
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.core.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   
 
15    public class GpaContextImplTest {
16    private GpaContextImpl gpaContext = new GpaContextImpl();
17    private ReqComponentInfo reqComponent1;
18    private ReqComponentInfo reqComponent2;
19   
 
20  2 toggle private void setupReqComponent1() {
21  2 reqComponent1 = new ReqComponentInfo();
22  2 List<ReqCompFieldInfo> reqCompFieldList = new ArrayList<ReqCompFieldInfo>();
23  2 ReqCompFieldInfo reqCompField1 = new ReqCompFieldInfo();
24  2 reqCompField1.setType(ReqComponentFieldTypes.GPA_KEY.getId());
25  2 reqCompField1.setValue("2.75");
26  2 reqCompFieldList.add(reqCompField1);
27  2 reqComponent1.setReqCompFields(reqCompFieldList);
28    }
29   
 
30  2 toggle private void setupReqComponent2() {
31  2 reqComponent2 = new ReqComponentInfo();
32  2 List<ReqCompFieldInfo> reqCompFieldList = new ArrayList<ReqCompFieldInfo>();
33  2 ReqCompFieldInfo reqCompField1 = new ReqCompFieldInfo();
34  2 reqCompField1.setType(ReqComponentFieldTypes.GPA_KEY.getId());
35  2 reqCompField1.setValue(null);
36  2 reqCompFieldList.add(reqCompField1);
37  2 reqComponent2.setReqCompFields(reqCompFieldList);
38    }
39   
 
40  2 toggle @Before
41    public void beforeMethod() {
42  2 setupReqComponent1();
43  2 setupReqComponent2();
44    }
45   
 
46  1 toggle @Test
47    public void testCreateContextMap() throws OperationFailedException {
48  1 Map<String, Object> contextMap = gpaContext.createContextMap(reqComponent1);
49  1 Double gpa = (Double) contextMap.get(GpaContextImpl.GPA_TOKEN);
50  1 Assert.assertEquals(2.75d, gpa.doubleValue(), 0d);
51    }
52   
 
53  1 toggle @Test
54    public void testCreateContextMap_NullGpa() throws OperationFailedException {
55  1 Map<String, Object> contextMap = gpaContext.createContextMap(reqComponent2);
56  1 Double gpa = (Double) contextMap.get(GpaContextImpl.GPA_TOKEN);
57  1 Assert.assertEquals(null, gpa);
58    }
59    }