@Test public void testValidateFieldUnexpectedWidget() { FormField field = mock(FormField.class); IsWidget widget = mock(IsWidget.class); when(field.getWidget()).thenReturn(widget); when(field.isRequired()).thenReturn(true); assertThatThrownBy(() -> fieldStateValidator.validate(field)) .isInstanceOf(IllegalStateException.class) .hasMessageContaining("Unexpected widget type: impossible to read the value"); }
@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);  }