KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > inversoft > verge > mvc > model > actionflow > test > TestValidator


1 /*
2  * Copyright (c) 2003, Inversoft
3  *
4  * This software is distribuable under the GNU Lesser General Public License.
5  * For more information visit gnu.org.
6  */

7 package com.inversoft.verge.mvc.model.actionflow.test;
8
9
10 import java.util.Map JavaDoc;
11
12 import junit.framework.Assert;
13
14 import com.inversoft.verge.mvc.controller.Action;
15 import com.inversoft.verge.mvc.validator.Validator;
16 import com.inversoft.verge.util.WebBeanProperty;
17
18
19 /**
20  * <p>
21  * This class is a test validator
22  * </p>
23  *
24  * @author Brian Pontarelli
25  * @since 2.0
26  * @version 2.0
27  */

28 public class TestValidator implements Validator {
29
30     public static boolean conversion = false;
31
32
33     /**
34      * Constructor for TestValidator.
35      */

36     public TestValidator() {
37         super();
38     }
39     
40
41     /**
42      * Does nothing right now
43      */

44     public boolean validate(Map JavaDoc modelObjects, Action action) {
45         return false;
46     }
47
48     /**
49      * This gets caled by the model handler
50      */

51     public void handleConversion(Object JavaDoc model, WebBeanProperty property,
52             Action action) {
53         conversion = true;
54         Assert.assertTrue("model should be instance of Bean1", model instanceof Bean1);
55         Assert.assertTrue("property should be integer", property.getPropertyName().equals("integer"));
56         Assert.assertTrue("property should be integer", property.getPropertyType() == Integer JavaDoc.class);
57         Assert.assertTrue("RequestContext should never be null", action.getRequestContext() != null);
58     }
59 }
60
Popular Tags