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