1 |
|
package org.kuali.student.lum.course.service.impl; |
2 |
|
|
3 |
|
import java.util.LinkedHashSet; |
4 |
|
import java.util.List; |
5 |
|
import java.util.Set; |
6 |
|
import org.junit.Test; |
7 |
|
import org.kuali.student.common.dictionary.service.impl.DictionaryTesterHelper; |
8 |
|
import org.kuali.student.lum.lrc.dto.CredentialInfo; |
9 |
|
import org.kuali.student.lum.lrc.dto.CreditInfo; |
10 |
|
import org.kuali.student.lum.lrc.dto.GradeInfo; |
11 |
|
import org.kuali.student.lum.lrc.dto.ResultComponentInfo; |
12 |
|
import org.kuali.student.lum.lrc.dto.ScaleInfo; |
13 |
|
import static org.junit.Assert.*; |
14 |
|
|
|
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 3 |
Complexity Density: 0.17 |
|
15 |
|
public class TestLrcDictionary |
16 |
|
{ |
17 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 2 |
Complexity Density: 0.17 |
4
-
|
|
18 |
0
|
@Test... |
19 |
|
public void testLoadLrcDictionary () |
20 |
|
{ |
21 |
0
|
Set<String> startingClasses = new LinkedHashSet (); |
22 |
0
|
startingClasses.add (ResultComponentInfo.class.getName ()); |
23 |
0
|
startingClasses.add (CreditInfo.class.getName ()); |
24 |
0
|
startingClasses.add (CredentialInfo.class.getName ()); |
25 |
0
|
startingClasses.add (ScaleInfo.class.getName ()); |
26 |
0
|
startingClasses.add (GradeInfo.class.getName ()); |
27 |
0
|
String contextFile = "ks-lrc-dictionary-context"; |
28 |
0
|
String outFile = "target/" + contextFile + ".txt"; |
29 |
0
|
DictionaryTesterHelper helper = new DictionaryTesterHelper (outFile, |
30 |
|
startingClasses, |
31 |
|
contextFile |
32 |
|
+ ".xml", |
33 |
|
false); |
34 |
0
|
List<String> errors = helper.doTest (); |
35 |
0
|
if (errors.size () > 0) |
36 |
|
{ |
37 |
0
|
fail ("failed dictionary validation:\n" + formatAsString (errors)); |
38 |
|
} |
39 |
|
} |
40 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
41 |
0
|
private String formatAsString (List<String> errors)... |
42 |
|
{ |
43 |
0
|
int i = 0; |
44 |
0
|
StringBuilder builder = new StringBuilder (); |
45 |
0
|
for (String error : errors) |
46 |
|
{ |
47 |
0
|
i ++; |
48 |
0
|
builder.append (i + ". " + error + "\n"); |
49 |
|
} |
50 |
0
|
return builder.toString (); |
51 |
|
} |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
} |