001    /*
002     * To change this template, choose Tools | Templates
003     * and open the template in the editor.
004     */
005    package org.kuali.student.datadictionary.util;
006    
007    import static org.junit.Assert.assertEquals;
008    
009    import java.util.Stack;
010    
011    import org.junit.After;
012    import org.junit.AfterClass;
013    import org.junit.Before;
014    import org.junit.BeforeClass;
015    import org.junit.Test;
016    import org.kuali.rice.krad.datadictionary.DataDictionaryDefinitionBase;
017    import org.kuali.rice.krad.datadictionary.DataObjectEntry;
018    import org.kuali.student.contract.model.test.source.AtpInfo;
019    import org.kuali.student.r2.core.exemption.dto.ExemptionInfo;
020    import org.kuali.student.validation.decorator.mojo.ValidationDecoratorWriterForOneService;
021    import org.slf4j.Logger;
022    import org.slf4j.LoggerFactory;
023    
024    /**
025     *
026     * @author nwright
027     */
028    public class Bean2DictionaryConverterTest {
029        
030        private static Logger log = LoggerFactory.getLogger(Bean2DictionaryConverterTest.class);
031        
032    
033        public Bean2DictionaryConverterTest() {
034        }
035    
036        @BeforeClass
037        public static void setUpClass() throws Exception {
038        }
039    
040        @AfterClass
041        public static void tearDownClass() throws Exception {
042        }
043    
044        @Before
045        public void setUp() {
046        }
047    
048        @After
049        public void tearDown() {
050        }
051    
052        /**
053         * Test of convert method, of class Bean2DictionaryConverter.
054         */
055        @Test
056        public void testConvert() {
057            log.info("convert");
058            Class<?> clazz = null;
059            Stack<DataDictionaryDefinitionBase> parentFields = null;
060            Stack<Class<?>> parentClasses = null;
061            Bean2DictionaryConverter instance = null;
062            DataObjectEntry result = null;
063            
064            clazz = AtpInfo.class;
065            parentFields = new Stack<DataDictionaryDefinitionBase>();
066            parentClasses = new Stack<Class<?>>();        
067            instance = new Bean2DictionaryConverter(clazz, parentFields, parentClasses);
068            result = instance.convert();
069            assertEquals(13, result.getAttributes().size());
070    
071            clazz = ExemptionInfo.class;
072            parentFields = new Stack<DataDictionaryDefinitionBase>();
073            parentClasses = new Stack<Class<?>>();        
074            instance = new Bean2DictionaryConverter(clazz, parentFields, parentClasses);
075            result = instance.convert();
076            assertEquals(22, result.getAttributes().size());        
077        }
078    }