@Test
public void requiresValidation() {

    AbstractFormItem<String> formItem = formItem(false);
    formItem.setUndefined(false);
    formItem.setRequired(true);
    assertTrue(formItem.requiresValidation());
    formItem = formItem(false);
    formItem.setUndefined(true);
    assertFalse(formItem.requiresValidation());
    formItem = formItem(false);
    formItem.setUndefined(false);
    formItem.setModified(true);
    assertFalse(formItem.requiresValidation());
    formItem = formItem(false);
    formItem.setUndefined(false);
    formItem.setModified(true);
    formItem.addValidationHandler(value -> ValidationResult.OK);
    assertTrue(formItem.requiresValidation());
}