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 junit.framework.Test;
22  import junit.framework.TestSuite;
23  
24  import org.apache.myfaces.trinidad.component.UIXPanel;
25  
26  /**
27   * Unit tests for CorePanelHeader.
28   *
29   */
30  public class CorePanelHeaderTest extends UIXPanelTestCase
31  {
32    /**
33     * Creates a new CorePanelHeaderTest.
34     *
35     * @param testName  the unit test name
36     */
37    public CorePanelHeaderTest(
38      String testName)
39    {
40      super(testName);
41    }
42    
43    @Override
44    protected void setUp() throws Exception
45    {
46      super.setUp();
47    }
48    
49    @Override
50    protected void tearDown() throws Exception
51    {
52      super.tearDown();
53    }
54    
55    public static Test suite()
56    {
57      return new TestSuite(CorePanelHeaderTest.class);
58    }
59  
60    /**
61     * Tests the initial values for the component attributes.
62     * @todo deal with size attr
63     */
64    public void testInitialAttributeValues()
65    {
66      CorePanelHeader component = new CorePanelHeader();
67  
68      assertTrue(component.isRendered());
69      assertNull(component.getIcon());
70      assertNull(component.getText());
71      assertEquals("none", component.getMessageType());
72    }
73  
74    /**
75     * Tests the transparency of the component attribute by comparing
76     * bean accessor and mutator methods with attribute map accessor
77     * and mutator methods.
78     * @todo deal with size attr
79     */
80    public void testAttributeTransparency()
81    {
82      CorePanelHeader component = new CorePanelHeader();
83  
84      doTestAttributeTransparency(component, "rendered",
85                                  Boolean.TRUE, Boolean.FALSE);
86      doTestAttributeTransparency(component, "messageType",
87                                  "error", "warning");
88      doTestAttributeTransparency(component, "text",
89                                  "foo", "bar");
90      doTestAttributeTransparency(component, "icon",
91                                  "foo", "bar");
92    }
93  
94    @Override
95    protected UIXPanel createTestComponent()
96    {
97      return new CorePanelHeader();
98    }
99  }