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 15 public class TestLrcDictionary 16 { 17 18 @Test 19 public void testLoadLrcDictionary () 20 { 21 Set<String> startingClasses = new LinkedHashSet (); 22 startingClasses.add (ResultComponentInfo.class.getName ()); 23 startingClasses.add (CreditInfo.class.getName ()); 24 startingClasses.add (CredentialInfo.class.getName ()); 25 startingClasses.add (ScaleInfo.class.getName ()); 26 startingClasses.add (GradeInfo.class.getName ()); 27 String contextFile = "ks-lrc-dictionary-context"; 28 String outFile = "target/" + contextFile + ".txt"; 29 DictionaryTesterHelper helper = new DictionaryTesterHelper (outFile, 30 startingClasses, 31 contextFile 32 + ".xml", 33 false); 34 List<String> errors = helper.doTest (); 35 if (errors.size () > 0) 36 { 37 fail ("failed dictionary validation:\n" + formatAsString (errors)); 38 } 39 } 40 41 private String formatAsString (List<String> errors) 42 { 43 int i = 0; 44 StringBuilder builder = new StringBuilder (); 45 for (String error : errors) 46 { 47 i ++; 48 builder.append (i + ". " + error + "\n"); 49 } 50 return builder.toString (); 51 } 52 53 54 55 }