use of com.opensymphony.xwork2.interceptor.ValidationAware in project struts by apache.
the class OValValidationInterceptorTest method testSimpleFieldsXML.
public void testSimpleFieldsXML() throws Exception {
ActionProxy baseActionProxy = actionProxyFactory.createActionProxy("oval", "simpleFieldsXML", null, null);
baseActionProxy.execute();
Map<String, List<String>> fieldErrors = ((ValidationAware) baseActionProxy.getAction()).getFieldErrors();
assertNotNull(fieldErrors);
assertEquals(2, fieldErrors.size());
assertValue(fieldErrors, "firstName", Collections.singletonList("firstName cannot be null"));
assertValue(fieldErrors, "lastName", Collections.singletonList("lastName cannot be null"));
}
use of com.opensymphony.xwork2.interceptor.ValidationAware in project struts by apache.
the class OValValidationInterceptorTest method testProgrammaticValidationDontInvokeProgrammatic.
public void testProgrammaticValidationDontInvokeProgrammatic() throws Exception {
ActionProxy baseActionProxy = actionProxyFactory.createActionProxy("oval", "simpleFieldNoProgrammatic", null, null);
SimpleField action = (SimpleField) baseActionProxy.getAction();
baseActionProxy.execute();
Map<String, List<String>> fieldErrors = ((ValidationAware) baseActionProxy.getAction()).getFieldErrors();
assertNotNull(fieldErrors);
assertEquals(1, fieldErrors.size());
assertValue(fieldErrors, "name", Collections.singletonList("name cannot be null"));
assertFalse(action.isValidateCalled());
assertFalse(action.isValidateExecuteCalled());
}
Aggregations