View Javadoc

1   package javax.faces.component;
2   
3   import javax.faces.component.html.HtmlInputText;
4   
5   import org.apache.shale.test.base.AbstractJsfTestCase;
6   
7   public class UIComponentAttributesTest extends AbstractJsfTestCase{
8     
9       public UIComponentAttributesTest(String arg0)
10      {
11          super(arg0);
12      }
13  
14      private HtmlInputText input;
15      
16      
17      protected void setUp() throws Exception {
18          super.setUp();
19          input = new HtmlInputText();
20          input.setId("testId");
21      }
22  
23      protected void tearDown() throws Exception {
24          super.tearDown();
25          input = null;
26      }
27  
28      public void testSetNullAttributeOnValidProperty(){
29          input.getAttributes().put("style", null);
30    }
31      public void testSetNullAttributeOnInvalidProperty(){
32          try{
33              input.getAttributes().put("someBogus", null);
34              fail("Should have thrown NullPointerException");
35          }
36          catch(NullPointerException npe){
37              //expected
38          }
39      }
40  }