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 CorePanelAccordion
30   *
31   */
32  
33  public class CorePanelAccordionTest extends UIComponentTestCase
34  {
35    /**
36     * Creates a new CorePanelAccordion.
37     *
38     * @param testName  the unit test name
39     */
40    public CorePanelAccordionTest(String testName)
41    {
42      super(testName);
43    }
44    
45    @Override
46    protected void setUp() throws Exception
47    {
48      super.setUp();
49    }
50    
51    @Override
52    protected void tearDown() throws Exception
53    {
54      super.tearDown();
55    }
56    
57    public static Test suite()
58    {
59      return new TestSuite(CorePanelAccordionTest.class);
60    }
61  
62    /**
63     * Tests the Initial values for the component attributes.
64     */
65    public void testInitialAttributeValues()
66    {
67      CorePanelAccordion component = new CorePanelAccordion();
68      assertEquals(true, component.isRendered());
69    }
70  
71    /**
72     * Tests the values set for the component attributes.
73     */
74    public void testgetAttributeValues()
75    {
76      CorePanelAccordion component = new CorePanelAccordion();
77      assertEquals("org.apache.myfaces.trinidad.Panel",component.getFamily());
78    }
79  
80    /**
81     * Tests the transparency of the component attribute by comparing
82     * bean accessor and mutator methods with attribute map accessor
83     * and mutator methods.
84     *
85     */
86    public void testAttributeTransparency()
87    {
88      CorePanelAccordion component= new CorePanelAccordion();
89      doTestAttributeTransparency(component,
90                                  "rendered",
91                                  Boolean.TRUE, Boolean.FALSE);
92    }
93  
94    /**
95     * Tests the Apply Request Values Phase
96     */
97    public void testApplyRequestValues()
98    {
99      CorePanelAccordion component= new CorePanelAccordion();
100     doTestApplyRequestValues(component);
101     component= new CorePanelAccordion();
102     component.setRendered(false);
103     doTestApplyRequestValues(component);
104     component= new CorePanelAccordion();
105   }
106 
107   /**
108    * Tests the process-validations lifecycle phase.
109    */
110   public void testProcessValidations()
111   {
112     CorePanelAccordion component= new CorePanelAccordion();
113     doTestProcessValidations(component);
114   }
115 
116   /**
117    * Tests the update-model-values lifecycle phase.
118    */
119   public void testUpdateModelValues()
120   {
121     CorePanelAccordion component= new CorePanelAccordion();
122     doTestUpdateModelValues(component);
123   }
124 
125   /**
126    * Tests the invoke-application lifecycle phase.
127    */
128   public void testInvokeApplication()
129   {
130     CorePanelAccordion component= new CorePanelAccordion();
131     doTestInvokeApplication(component, null);
132   }
133   /**
134    * Tests the render-response lifecycle phase.
135    *
136    * @throws IOException  when test fails
137    */
138   public void testRenderResponse() throws IOException
139   {
140     CorePanelAccordion component= new CorePanelAccordion();
141     doTestRenderResponse(component);
142   }
143 }
144