001    /**
002     * Copyright 2004-2013 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    /*
017     * To change this template, choose Tools | Templates
018     * and open the template in the editor.
019     */
020    package org.kuali.student.datadictionary.util;
021    
022    import static org.junit.Assert.assertEquals;
023    
024    import java.util.Stack;
025    
026    import org.junit.After;
027    import org.junit.AfterClass;
028    import org.junit.Before;
029    import org.junit.BeforeClass;
030    import org.junit.Test;
031    import org.kuali.rice.krad.datadictionary.DataDictionaryDefinitionBase;
032    import org.kuali.rice.krad.datadictionary.DataObjectEntry;
033    import org.kuali.student.contract.model.test.source.AtpInfo;
034    import org.kuali.student.r2.core.exemption.dto.ExemptionInfo;
035    import org.kuali.student.validation.decorator.mojo.ValidationDecoratorWriterForOneService;
036    import org.slf4j.Logger;
037    import org.slf4j.LoggerFactory;
038    
039    /**
040     *
041     * @author nwright
042     */
043    public class Bean2DictionaryConverterTest {
044        
045        private static Logger log = LoggerFactory.getLogger(Bean2DictionaryConverterTest.class);
046        
047    
048        public Bean2DictionaryConverterTest() {
049        }
050    
051        @BeforeClass
052        public static void setUpClass() throws Exception {
053        }
054    
055        @AfterClass
056        public static void tearDownClass() throws Exception {
057        }
058    
059        @Before
060        public void setUp() {
061        }
062    
063        @After
064        public void tearDown() {
065        }
066    
067        /**
068         * Test of convert method, of class Bean2DictionaryConverter.
069         */
070        @Test
071        public void testConvert() {
072            log.info("convert");
073            Class<?> clazz = null;
074            Stack<DataDictionaryDefinitionBase> parentFields = null;
075            Stack<Class<?>> parentClasses = null;
076            Bean2DictionaryConverter instance = null;
077            DataObjectEntry result = null;
078            
079            clazz = AtpInfo.class;
080            parentFields = new Stack<DataDictionaryDefinitionBase>();
081            parentClasses = new Stack<Class<?>>();        
082            instance = new Bean2DictionaryConverter(clazz, parentFields, parentClasses);
083            result = instance.convert();
084            assertEquals(13, result.getAttributes().size());
085    
086            clazz = ExemptionInfo.class;
087            parentFields = new Stack<DataDictionaryDefinitionBase>();
088            parentClasses = new Stack<Class<?>>();        
089            instance = new Bean2DictionaryConverter(clazz, parentFields, parentClasses);
090            result = instance.convert();
091            assertEquals(22, result.getAttributes().size());        
092        }
093    }