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 java.util.Stack;
8   import org.junit.After;
9   import org.junit.AfterClass;
10  import org.junit.Before;
11  import org.junit.BeforeClass;
12  import org.junit.Test;
13  import static org.junit.Assert.*;
14  import org.kuali.rice.krad.datadictionary.DataDictionaryDefinitionBase;
15  import org.kuali.rice.krad.datadictionary.DataObjectEntry;
16  import org.kuali.student.contract.model.test.source.AtpInfo;
17  import org.kuali.student.r2.core.exemption.dto.ExemptionInfo;
18  
19  /**
20   *
21   * @author nwright
22   */
23  public class Bean2DictionaryConverterTest {
24  
25      public Bean2DictionaryConverterTest() {
26      }
27  
28      @BeforeClass
29      public static void setUpClass() throws Exception {
30      }
31  
32      @AfterClass
33      public static void tearDownClass() throws Exception {
34      }
35  
36      @Before
37      public void setUp() {
38      }
39  
40      @After
41      public void tearDown() {
42      }
43  
44      /**
45       * Test of convert method, of class Bean2DictionaryConverter.
46       */
47      @Test
48      public void testConvert() {
49          System.out.println("convert");
50          Class<?> clazz = null;
51          Stack<DataDictionaryDefinitionBase> parentFields = null;
52          Stack<Class<?>> parentClasses = null;
53          Bean2DictionaryConverter instance = null;
54          DataObjectEntry result = null;
55          
56          clazz = AtpInfo.class;
57          parentFields = new Stack<DataDictionaryDefinitionBase>();
58          parentClasses = new Stack<Class<?>>();        
59          instance = new Bean2DictionaryConverter(clazz, parentFields, parentClasses);
60          result = instance.convert();
61          assertEquals(13, result.getAttributes().size());
62  
63          clazz = ExemptionInfo.class;
64          parentFields = new Stack<DataDictionaryDefinitionBase>();
65          parentClasses = new Stack<Class<?>>();        
66          instance = new Bean2DictionaryConverter(clazz, parentFields, parentClasses);
67          result = instance.convert();
68          assertEquals(22, result.getAttributes().size());        
69      }
70  }