@Test public void testValidateCustomValidatorsWithError() { when(textBox.getValue()).thenReturn("abcd"); CustomFieldValidator validator = o -> ValidationResult.error(MESSAGE); when(textBoxField.getCustomValidators()).thenReturn(Collections.singletonList(validator)); assertFalse(fieldStateValidator.validate(textBoxField)); verify(textBoxField).showError(eq(MESSAGE)); verify(textBoxField, never()).showWarning(any()); }
@Override public boolean validate(Collection<FormField> fields) { boolean isValid = true; for (FormField field : fields) { isValid = validate(field) && isValid; } return isValid; }
FieldStateValidatorImpl implements FieldStateValidator { @Override public boolean validate(Collection<FormField> fields) { boolean isValid = true; for (FormField field : fields) { isValid = validate(field) && isValid; } return isValid; } }
FieldStateValidatorImpl implements FieldStateValidator { @Override public boolean validate(Collection<FormField> fields) { boolean isValid = true; for (FormField field : fields) { isValid = validate(field) && isValid; } return isValid; } @Inject  FieldStateValidatorImpl(TranslationService translationService); }
FieldStateValidatorImpl implements FieldStateValidator { @Override public boolean validate(Collection<FormField> fields) { boolean isValid = true; for (FormField field : fields) { isValid = validate(field) && isValid; } return isValid; } @Inject  FieldStateValidatorImpl(TranslationService translationService); @PostConstruct void initialize(); @Override boolean validate(Collection<FormField> fields); @Override boolean validate(FormField field); }
FieldStateValidatorImpl implements FieldStateValidator { @Override public boolean validate(Collection<FormField> fields) { boolean isValid = true; for (FormField field : fields) { isValid = validate(field) && isValid; } return isValid; } @Inject  FieldStateValidatorImpl(TranslationService translationService); @PostConstruct void initialize(); @Override boolean validate(Collection<FormField> fields); @Override boolean validate(FormField field);  }