View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.myfaces.trinidad.component.core.layout;
20  
21  import java.io.IOException;
22  
23  import junit.framework.Test;
24  import junit.framework.TestSuite;
25  
26  import org.apache.myfaces.trinidad.component.UIComponentTestCase;
27  
28  /**
29   * Unit tests for CorePanelRadio
30   *
31   * @version $Name:  $ ($Revision: adfrt/faces/adf-faces-api/src/test/java/oracle/adf/view/faces/component/core/layout/CoreShowOneRadioTest.java#1 $) $Date: 16-aug-2005.15:12:21 $
32   */
33  
34  public class CorePanelRadioTest extends UIComponentTestCase
35  {
36    /**
37     * Creates a new CorePanelRadio.
38     *
39     * @param testName  the unit test name
40     */
41     public CorePanelRadioTest(String testName)
42     {
43       super(testName);
44     }
45     
46     @Override
47     protected void setUp() throws Exception
48     {
49       super.setUp();
50     }
51     
52     @Override
53     protected void tearDown() throws Exception
54     {
55       super.tearDown();
56     }
57     
58     public static Test suite()
59     {
60       return new TestSuite(CorePanelRadioTest.class);
61     }
62  
63    /**
64     * Tests the Initial values for the component attributes.
65     */
66     public void testInitialAttributeValues()
67     {
68       CorePanelRadio component = new CorePanelRadio();
69       assertEquals(true, component.isRendered());
70       assertNull(component.getLabel());
71       assertEquals("start",component.getPosition());
72       assertEquals("center", component.getAlignment());
73     }
74  
75    /**
76     * Tests the values set for the component attributes.
77     */
78     public void testgetAttributeValues()
79     {
80       CorePanelRadio component = new CorePanelRadio();
81       assertEquals("org.apache.myfaces.trinidad.ShowOne",component.getFamily());
82     }
83  
84    /**
85     * Tests the transparency of the component attribute by comparing
86     * bean accessor and mutator methods with attribute map accessor
87     * and mutator methods.
88     */
89     public void testAttributeTransparency()
90     {
91       CorePanelRadio component= new CorePanelRadio();
92       doTestAttributeTransparency(component, "rendered",
93                                      Boolean.TRUE, Boolean.FALSE);
94       doTestAttributeTransparency(component, "label", "foo", "bar");
95       doTestAttributeTransparency(component, "position", "start", "top");
96       doTestAttributeTransparency(component, "alignment", "center", "bottom");
97     }
98  
99    /**
100    * Tests the Apply Request Values Phase
101    */
102    public void testApplyRequestValues()
103    {
104      CorePanelRadio component= new CorePanelRadio();
105      doTestApplyRequestValues(component);
106      component= new CorePanelRadio();
107      component.setRendered(false);
108      doTestApplyRequestValues(component);
109    }
110 
111   /**
112    * Tests the process-validations lifecycle phase.
113    */
114    public void testProcessValidations()
115    {
116      CorePanelRadio component= new CorePanelRadio();
117      doTestProcessValidations(component);
118    }
119 
120   /**
121    * Tests the update-model-values lifecycle phase.
122    */
123    public void testUpdateModelValues()
124    {
125      CorePanelRadio component= new CorePanelRadio();
126      doTestUpdateModelValues(component);
127    }
128 
129   /**
130    * Tests the invoke-application lifecycle phase.
131    */
132    public void testInvokeApplication()
133    {
134      CorePanelRadio component= new CorePanelRadio();
135      doTestInvokeApplication(component, null);
136    }
137 
138   /**
139    * Tests the render-response lifecycle phase.
140    *
141    * @throws IOException  when test fails
142    */
143    public void testRenderResponse() throws IOException
144    {
145      CorePanelRadio component= new CorePanelRadio();
146      doTestRenderResponse(component);
147    }
148 
149   }
150