use of org.apache.tapestry5.services.FieldValidatorSource in project tapestry-5 by apache.
the class ValidateBindingFactoryTest method success.
@Test
public void success() {
FieldValidatorSource source = mockFieldValidatorSource();
ComponentResources container = mockComponentResources();
ComponentResources component = mockComponentResources();
FieldComponent instance = mockFieldComponent();
Location l = mockLocation();
FieldValidator validator = mockFieldValidator();
String expression = "required,minLength=5";
train_getComponent(component, instance);
expect(source.createValidators(instance, expression)).andReturn(validator);
replay();
BindingFactory factory = new ValidateBindingFactory(source, interner);
Binding binding = factory.newBinding("descrip", container, component, expression, l);
assertSame(binding.get(), validator);
verify();
}
Aggregations