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 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (27) |
Complexity: 5 |
Complexity Density: 0.23 |
|
15 |
|
public class GpaContextImplTest { |
16 |
|
private GpaContextImpl gpaContext = new GpaContextImpl(); |
17 |
|
private ReqComponentInfo reqComponent1; |
18 |
|
private ReqComponentInfo reqComponent2; |
19 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
20 |
2
|
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 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
30 |
2
|
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 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
40 |
2
|
@Before... |
41 |
|
public void beforeMethod() { |
42 |
2
|
setupReqComponent1(); |
43 |
2
|
setupReqComponent2(); |
44 |
|
} |
45 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1
PASS
|
|
46 |
1
|
@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 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1
PASS
|
|
53 |
1
|
@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 |
|
} |