View Javadoc

1   /*
2    * To change this template, choose Tools | Templates
3    * and open the template in the editor.
4    */
5   package org.kuali.student.datadictionary.util;
6   
7   import static org.junit.Assert.assertEquals;
8   
9   import java.util.Stack;
10  
11  import org.junit.After;
12  import org.junit.AfterClass;
13  import org.junit.Before;
14  import org.junit.BeforeClass;
15  import org.junit.Test;
16  import org.kuali.rice.krad.datadictionary.DataDictionaryDefinitionBase;
17  import org.kuali.rice.krad.datadictionary.DataObjectEntry;
18  import org.kuali.student.contract.model.test.source.AtpInfo;
19  import org.kuali.student.r2.core.exemption.dto.ExemptionInfo;
20  import org.kuali.student.validation.decorator.mojo.ValidationDecoratorWriterForOneService;
21  import org.slf4j.Logger;
22  import org.slf4j.LoggerFactory;
23  
24  /**
25   *
26   * @author nwright
27   */
28  public class Bean2DictionaryConverterTest {
29      
30      private static Logger log = LoggerFactory.getLogger(Bean2DictionaryConverterTest.class);
31      
32  
33      public Bean2DictionaryConverterTest() {
34      }
35  
36      @BeforeClass
37      public static void setUpClass() throws Exception {
38      }
39  
40      @AfterClass
41      public static void tearDownClass() throws Exception {
42      }
43  
44      @Before
45      public void setUp() {
46      }
47  
48      @After
49      public void tearDown() {
50      }
51  
52      /**
53       * Test of convert method, of class Bean2DictionaryConverter.
54       */
55      @Test
56      public void testConvert() {
57          log.info("convert");
58          Class<?> clazz = null;
59          Stack<DataDictionaryDefinitionBase> parentFields = null;
60          Stack<Class<?>> parentClasses = null;
61          Bean2DictionaryConverter instance = null;
62          DataObjectEntry result = null;
63          
64          clazz = AtpInfo.class;
65          parentFields = new Stack<DataDictionaryDefinitionBase>();
66          parentClasses = new Stack<Class<?>>();        
67          instance = new Bean2DictionaryConverter(clazz, parentFields, parentClasses);
68          result = instance.convert();
69          assertEquals(13, result.getAttributes().size());
70  
71          clazz = ExemptionInfo.class;
72          parentFields = new Stack<DataDictionaryDefinitionBase>();
73          parentClasses = new Stack<Class<?>>();        
74          instance = new Bean2DictionaryConverter(clazz, parentFields, parentClasses);
75          result = instance.convert();
76          assertEquals(22, result.getAttributes().size());        
77      }
78  }