001 package org.kuali.student.lum.course.service.impl; 002 003 import java.util.LinkedHashSet; 004 import java.util.List; 005 import java.util.Set; 006 import org.junit.Test; 007 import org.kuali.student.core.dictionary.service.impl.DictionaryTesterHelper; 008 import static org.junit.Assert.fail; 009 010 public class TestClusetUiObjectDictionary 011 { 012 013 @Test 014 public void testLoadCluSetInfoDictionary () 015 { 016 Set<String> startingClasses = new LinkedHashSet (); 017 startingClasses.add ("cluset"); 018 startingClasses.add ("courseSet"); 019 startingClasses.add ("programSet"); 020 startingClasses.add ("testSet"); 021 String contextFile = "ks-cluset-ui-object-dictionary-context"; 022 String outFile = "target/" + contextFile + ".txt"; 023 DictionaryTesterHelper helper = new DictionaryTesterHelper (outFile, 024 startingClasses, 025 contextFile 026 + ".xml", 027 true); 028 List<String> errors = helper.doTest (); 029 if (errors.size () > 0) 030 { 031 fail ("failed dictionary validation:\n" + formatAsString (errors)); 032 } 033 } 034 035 private String formatAsString (List<String> errors) 036 { 037 int i = 0; 038 StringBuilder builder = new StringBuilder (); 039 for (String error : errors) 040 { 041 i ++; 042 builder.append (i + ". " + error + "\n"); 043 } 044 return builder.toString (); 045 } 046 }