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  
21  /**
22   *
23   * @author nwright
24   */
25  public class Bean2DictionaryConverterTest {
26  
27      public Bean2DictionaryConverterTest() {
28      }
29  
30      @BeforeClass
31      public static void setUpClass() throws Exception {
32      }
33  
34      @AfterClass
35      public static void tearDownClass() throws Exception {
36      }
37  
38      @Before
39      public void setUp() {
40      }
41  
42      @After
43      public void tearDown() {
44      }
45  
46      /**
47       * Test of convert method, of class Bean2DictionaryConverter.
48       */
49      @Test
50      public void testConvert() {
51          System.out.println("convert");
52          Class<?> clazz = null;
53          Stack<DataDictionaryDefinitionBase> parentFields = null;
54          Stack<Class<?>> parentClasses = null;
55          Bean2DictionaryConverter instance = null;
56          DataObjectEntry result = null;
57          
58          clazz = AtpInfo.class;
59          parentFields = new Stack<DataDictionaryDefinitionBase>();
60          parentClasses = new Stack<Class<?>>();        
61          instance = new Bean2DictionaryConverter(clazz, parentFields, parentClasses);
62          result = instance.convert();
63          assertEquals(13, result.getAttributes().size());
64  
65          clazz = ExemptionInfo.class;
66          parentFields = new Stack<DataDictionaryDefinitionBase>();
67          parentClasses = new Stack<Class<?>>();        
68          instance = new Bean2DictionaryConverter(clazz, parentFields, parentClasses);
69          result = instance.convert();
70          assertEquals(22, result.getAttributes().size());        
71      }
72  }