### Question:
ValidEnumValueOrProfileAttributeValidator implements
        ConstraintValidator<ValidEnumValueOrProfileAttribute, String>, ValidationErrorDescriptorBuilder { @Override public boolean isValid(String value, ConstraintValidatorContext context) { final Pattern pattern = getProfileAttributeFunctionPattern(); return value == null || enumNames.contains(value) || pattern == null || pattern.matcher(value).matches(); }  @Override void initialize(ValidEnumValueOrProfileAttribute constraintAnnotation); @Override boolean isValid(String value, ConstraintValidatorContext context); @Override ErrorDescriptor build(ConstraintViolation violation);  }### Answer:
@Test public void isValid_nullValue_valid() { boolean result = validEnumValueOrProfileAttributeValidator.isValid(null, null); assertTrue(result); }
@Test public void isValid_enumValue_valid() { boolean result = validEnumValueOrProfileAttributeValidator.isValid(TestEnum.one.name(), null); assertTrue(result); }
@Test public void isValid_nullPattern_valid() { BridgeRegistry.registerBridge(SettingsBridge.class, null); boolean result = validEnumValueOrProfileAttributeValidator.isValid(SETTINGS_OBJECT.toString(), null); assertTrue(result); }
@Test public void isValid_valueMatchPattern_valid() { boolean result = validEnumValueOrProfileAttributeValidator.isValid(SETTINGS_OBJECT.toString(), null); assertTrue(result); }
@Test public void isValid_invalid() { boolean result = validEnumValueOrProfileAttributeValidator.isValid(INVALID_VALUE, null); assertFalse(result); }