001    /**
002     * Copyright 2005-2014 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    package org.kuali.rice.krad.uif.util;
017    
018    import static org.junit.Assert.assertEquals;
019    
020    import org.apache.log4j.Logger;
021    import org.junit.AfterClass;
022    import org.junit.Assume;
023    import org.junit.BeforeClass;
024    import org.junit.Ignore;
025    import org.junit.Test;
026    import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
027    import org.kuali.rice.krad.uif.element.Message;
028    import org.kuali.rice.krad.uif.view.InquiryView;
029    
030    /**
031     * Unit tests for proving correct operation of the ViewHelperService.
032     * 
033     * @author Kuali Rice Team (rice.collab@kuali.org)
034     */
035    public class ComponentFactoryTest extends ProcessLoggingUnitTest {
036        
037        @BeforeClass
038        public static void setUpClass() throws Throwable {
039            UifUnitTestUtils.establishMockConfig("KRAD-ComponentFactoryTest");
040        }
041    
042        @AfterClass
043        public static void tearDownClass() throws Throwable {
044            GlobalResourceLoader.stop();
045        }
046    
047        @Test
048        public void testSanity() throws Throwable {
049            try {
050                Message message = ComponentFactory.getMessage();
051                assertEquals("uif-message", message.getCssClasses().get(0));
052            } catch (NullPointerException e) {
053                Assume.assumeNoException("Missing required testing resources, skipping", e);
054            }
055        }
056    
057        @Test
058        public void testInquiry() throws Throwable {
059            try {
060                InquiryView inquiryView = ComponentFactory.getInquiryView();
061                assertEquals("uif-formView", inquiryView.getCssClasses().get(0));
062            } catch (NullPointerException e) {
063                Assume.assumeNoException("Missing required testing resources, skipping", e);
064            }
065        }
066    
067    }