View Javadoc

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.core.dictionary.service.impl.DictionaryTesterHelper;
8   import static org.junit.Assert.fail;
9   
10  public class TestClusetUiObjectDictionary
11  {
12  
13   @Test
14   public void testLoadCluSetInfoDictionary ()
15   {
16    Set<String> startingClasses = new LinkedHashSet ();
17    startingClasses.add ("cluset");
18    startingClasses.add ("courseSet");
19    startingClasses.add ("programSet");
20    startingClasses.add ("testSet");
21    String contextFile = "ks-cluset-ui-object-dictionary-context";
22    String outFile = "target/" + contextFile + ".txt";
23    DictionaryTesterHelper helper = new DictionaryTesterHelper (outFile,
24                                                                startingClasses,
25                                                                contextFile
26                                                                + ".xml",
27                                                                true);
28    List<String> errors = helper.doTest ();
29    if (errors.size () > 0)
30    {
31     fail ("failed dictionary validation:\n" + formatAsString (errors));
32    }
33   }
34  
35   private String formatAsString (List<String> errors)
36   {
37    int i = 0;
38    StringBuilder builder = new StringBuilder ();
39    for (String error : errors)
40    {
41     i ++;
42     builder.append (i + ". " + error + "\n");
43    }
44    return builder.toString ();
45   }
46  }