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.data;
20  
21  import java.io.IOException;
22  
23  import junit.framework.Test;
24  import junit.framework.TestSuite;
25  import junit.textui.TestRunner;
26  
27  import org.apache.myfaces.trinidad.component.UIComponentTestCase;
28  
29  /**
30   * Unit tests for CoreColumn.
31   *
32   */
33  public class CoreColumnTest extends UIComponentTestCase
34  {
35    /**
36     * Creates a new CoreColumnTest.
37     *
38     * @param testName  the unit test name
39     */
40    public CoreColumnTest(
41      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(CoreColumnTest.class);
61    }
62  
63    /**
64     * Tests the initial values for the component attributes.
65     */
66    public void testInitialAttributeValues()
67    {
68      CoreColumn component = new CoreColumn();
69      assertTrue(component.isRendered());
70    }
71  
72    /**
73     * Tests the transparency of the component attribute by comparing
74     * bean accessor and mutator methods with attribute map accessor
75     * and mutator methods.
76     */
77    public void testAttributeTransparency()
78    {
79      CoreColumn component = new CoreColumn();
80  
81      doTestAttributeTransparency(component, "separateRows",
82                                  Boolean.TRUE, Boolean.FALSE);
83      doTestAttributeTransparency(component, "headerNoWrap",
84                                  Boolean.TRUE, Boolean.FALSE);
85      doTestAttributeTransparency(component, "noWrap",
86                                  Boolean.TRUE, Boolean.FALSE);
87    }
88  
89    /**
90     * Tests the transparency of the component facets by comparing
91     * bean accessor and mutator methods with facet map accessor
92     * and mutator methods.
93     */
94    public void testFacetTransparency()
95    {
96      CoreColumn component = new CoreColumn();
97      doTestFacetTransparency(component, CoreColumn.HEADER_FACET);
98      doTestFacetTransparency(component, CoreColumn.FOOTER_FACET);
99    }
100 
101   /**
102    * Tests the apply-request-values lifecycle phase.
103    */
104   public void testApplyRequestValues()
105   {
106     CoreColumn component = new CoreColumn();
107     doTestApplyRequestValues(component);
108 
109     component = new CoreColumn();
110     component.setRendered(false);
111     doTestApplyRequestValues(component);
112   }
113 
114   /**
115    * Tests the process-validations lifecycle phase.
116    */
117   public void testProcessValidations()
118   {
119     CoreColumn component = new CoreColumn();
120     doTestProcessValidations(component);
121   }
122 
123   /**
124    * Tests the update-model-values lifecycle phase.
125    */
126   public void testUpdateModelValues()
127   {
128     CoreColumn component = new CoreColumn();
129     doTestUpdateModelValues(component);
130   }
131 
132   /**
133    * Tests the invoke-application lifecycle phase.
134    */
135   public void testInvokeApplication()
136   {
137     CoreColumn component = new CoreColumn();
138     doTestInvokeApplication(component, null);
139   }
140 
141   /**
142    * Tests the render-response lifecycle phase.
143    *
144    * @throws IOException  when test fails
145    */
146   public void testRenderResponse() throws IOException
147   {
148     CoreColumn component = new CoreColumn();
149     doTestRenderResponse(component);
150   }
151 
152   public static void main(String[] args)
153   {
154     TestRunner.run(CoreColumnTest.class);
155   }
156 
157 }