1 package org.apache.myfaces.custom.validators;
2
3 import javax.faces.component.UIComponent;
4 import javax.faces.validator.Validator;
5
6 import org.apache.myfaces.test.jmock.AbstractJmockJsfTestCase;
7 import org.jmock.Mock;
8
9 public abstract class AbstractValidatorTestCase extends AbstractJmockJsfTestCase
10 {
11
12 public AbstractValidatorTestCase(String arg0) {
13 super(arg0);
14 }
15
16 Mock mockComponent;
17 UIComponent component;
18
19 protected void setUp() throws Exception
20 {
21 super.setUp();
22 mockComponent = mock(UIComponent.class);
23 component = (UIComponent) mockComponent.proxy();
24
25 }
26
27 protected void tearDown() throws Exception
28 {
29 super.tearDown();
30 }
31
32
33
34
35
36 protected void doTestNullContext(
37 UIComponent component,
38 Validator validator) throws NullPointerException
39 {
40 try
41 {
42 validator.validate(null, component, "dummy");
43 fail("Expected NullpointerException - if context or component is null");
44 }
45 catch (NullPointerException npe)
46 {
47
48 }
49 }
50 }