View Javadoc
1   /**
2    * Copyright 2004-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  /*
17   * To change this template, choose Tools | Templates
18   * and open the template in the editor.
19   */
20  package org.kuali.student.datadictionary.util;
21  
22  import static org.junit.Assert.assertEquals;
23  
24  import java.util.Stack;
25  
26  import org.junit.After;
27  import org.junit.AfterClass;
28  import org.junit.Before;
29  import org.junit.BeforeClass;
30  import org.junit.Test;
31  import org.kuali.rice.krad.datadictionary.DataDictionaryDefinitionBase;
32  import org.kuali.rice.krad.datadictionary.DataObjectEntry;
33  import org.kuali.student.contract.model.test.source.AtpInfo;
34  import org.kuali.student.r2.core.exemption.dto.ExemptionInfo;
35  import org.kuali.student.validation.decorator.mojo.ValidationDecoratorWriterForOneService;
36  import org.slf4j.Logger;
37  import org.slf4j.LoggerFactory;
38  
39  /**
40   *
41   * @author nwright
42   */
43  public class Bean2DictionaryConverterTest {
44      
45      private static Logger log = LoggerFactory.getLogger(Bean2DictionaryConverterTest.class);
46      
47  
48      public Bean2DictionaryConverterTest() {
49      }
50  
51      @BeforeClass
52      public static void setUpClass() throws Exception {
53      }
54  
55      @AfterClass
56      public static void tearDownClass() throws Exception {
57      }
58  
59      @Before
60      public void setUp() {
61      }
62  
63      @After
64      public void tearDown() {
65      }
66  
67      /**
68       * Test of convert method, of class Bean2DictionaryConverter.
69       */
70      @Test
71      public void testConvert() {
72          log.info("convert");
73          Class<?> clazz = null;
74          Stack<DataDictionaryDefinitionBase> parentFields = null;
75          Stack<Class<?>> parentClasses = null;
76          Bean2DictionaryConverter instance = null;
77          DataObjectEntry result = null;
78          
79          clazz = AtpInfo.class;
80          parentFields = new Stack<DataDictionaryDefinitionBase>();
81          parentClasses = new Stack<Class<?>>();        
82          instance = new Bean2DictionaryConverter(clazz, parentFields, parentClasses);
83          result = instance.convert();
84          assertEquals(13, result.getAttributes().size());
85  
86          clazz = ExemptionInfo.class;
87          parentFields = new Stack<DataDictionaryDefinitionBase>();
88          parentClasses = new Stack<Class<?>>();        
89          instance = new Bean2DictionaryConverter(clazz, parentFields, parentClasses);
90          result = instance.convert();
91          assertEquals(22, result.getAttributes().size());        
92      }
93  }