Search in sources :

Example 1 with FieldAction

use of org.apache.struts.beanvalidation.actions.FieldAction in project struts by apache.

the class BeanValidationInterceptorTest method testFieldAction.

public void testFieldAction() throws Exception {
    ActionProxy baseActionProxy = actionProxyFactory.createActionProxy("bean-validation", "fieldAction", null, null);
    FieldAction action = (FieldAction) baseActionProxy.getAction();
    action.setTest(" ");
    baseActionProxy.execute();
    Map<String, List<String>> fieldErrors = ((ValidationAware) baseActionProxy.getAction()).getFieldErrors();
    assertNotNull(fieldErrors);
    assertEquals(1, fieldErrors.size());
    assertTrue(fieldErrors.get("test").size() > 0);
}
Also used : ActionProxy(com.opensymphony.xwork2.ActionProxy) FieldAction(org.apache.struts.beanvalidation.actions.FieldAction) List(java.util.List) ValidationAware(com.opensymphony.xwork2.interceptor.ValidationAware)

Aggregations

ActionProxy (com.opensymphony.xwork2.ActionProxy)1 ValidationAware (com.opensymphony.xwork2.interceptor.ValidationAware)1 List (java.util.List)1 FieldAction (org.apache.struts.beanvalidation.actions.FieldAction)1