use of com.opensymphony.xwork2.validator.DummyValidatorContext in project struts by apache.
the class URLValidatorTest method testAcceptNullValueForMutualExclusionOfValidators.
public void testAcceptNullValueForMutualExclusionOfValidators() throws Exception {
URLValidator validator = new URLValidator();
validator.setValidatorContext(new DummyValidatorContext(new Object(), tpf));
validator.setFieldName("testingUrl1");
validator.setValueStack(ActionContext.getContext().getValueStack());
validator.validate(new MyObject());
assertFalse(validator.getValidatorContext().hasErrors());
assertFalse(validator.getValidatorContext().hasActionErrors());
assertFalse(validator.getValidatorContext().hasActionMessages());
assertFalse(validator.getValidatorContext().hasFieldErrors());
}
use of com.opensymphony.xwork2.validator.DummyValidatorContext in project struts by apache.
the class URLValidatorTest method testArrayOfUrls.
public void testArrayOfUrls() throws Exception {
URLValidator validator = new URLValidator();
validator.setValidatorContext(new DummyValidatorContext(new Object(), tpf));
validator.setFieldName("urls");
validator.setValueStack(ActionContext.getContext().getValueStack());
validator.validate(new MyObject());
assertTrue(validator.getValidatorContext().hasErrors());
assertFalse(validator.getValidatorContext().hasActionErrors());
assertFalse(validator.getValidatorContext().hasActionMessages());
assertTrue(validator.getValidatorContext().hasFieldErrors());
assertEquals(1, validator.getValidatorContext().getFieldErrors().get("urls").size());
}
use of com.opensymphony.xwork2.validator.DummyValidatorContext in project struts by apache.
the class URLValidatorTest method testValidUrl1.
public void testValidUrl1() throws Exception {
URLValidator validator = new URLValidator();
validator.setValidatorContext(new DummyValidatorContext(new Object(), tpf));
validator.setFieldName("testingUrl4");
validator.setValueStack(ActionContext.getContext().getValueStack());
validator.validate(new MyObject());
assertFalse(validator.getValidatorContext().hasErrors());
assertFalse(validator.getValidatorContext().hasActionErrors());
assertFalse(validator.getValidatorContext().hasActionMessages());
assertFalse(validator.getValidatorContext().hasFieldErrors());
}
use of com.opensymphony.xwork2.validator.DummyValidatorContext in project struts by apache.
the class URLValidatorTest method testValidUrl2.
public void testValidUrl2() throws Exception {
URLValidator validator = new URLValidator();
validator.setValidatorContext(new DummyValidatorContext(new Object(), tpf));
validator.setFieldName("testingUrl5");
validator.setValueStack(ActionContext.getContext().getValueStack());
validator.validate(new MyObject());
assertFalse(validator.getValidatorContext().hasErrors());
assertFalse(validator.getValidatorContext().hasActionErrors());
assertFalse(validator.getValidatorContext().hasActionMessages());
assertFalse(validator.getValidatorContext().hasFieldErrors());
}
use of com.opensymphony.xwork2.validator.DummyValidatorContext in project struts by apache.
the class URLValidatorTest method testInvalidEmptyValue.
public void testInvalidEmptyValue() throws Exception {
URLValidator validator = new URLValidator();
validator.setValidatorContext(new DummyValidatorContext(new Object(), tpf));
validator.setFieldName("testingUrl2");
validator.setValueStack(ActionContext.getContext().getValueStack());
validator.validate(new MyObject());
assertFalse(validator.getValidatorContext().hasErrors());
assertFalse(validator.getValidatorContext().hasActionErrors());
assertFalse(validator.getValidatorContext().hasActionMessages());
assertFalse(validator.getValidatorContext().hasFieldErrors());
}
Aggregations