### Question:
RegexValidator implements ConfigurationOption.Validator<String> { private RegexValidator(String regex, String errorMessagePattern) { pattern = Pattern.compile(regex); this.errorMessagePattern = errorMessagePattern; } private  RegexValidator(String regex, String errorMessagePattern); static RegexValidator of(String regex); static RegexValidator of(String regex, String errorMessagePattern); @Override void assertValid(@Nullable String value);  }### Answer:
@Test void testRegexValidator() { SoftAssertions.assertSoftly(softly -> { softly.assertThatCode(() -> RegexValidator.of("foo").assertValid("foo")).doesNotThrowAnyException(); softly.assertThatCode(() -> RegexValidator.of("foo").assertValid(null)).doesNotThrowAnyException(); softly.assertThatCode(() -> RegexValidator.of("foo").assertValid("bar")) .isInstanceOf(IllegalArgumentException.class) .hasMessage("Value \"bar\" does not match regex foo"); softly.assertThatCode(() -> RegexValidator.of("foo", "{0} is not {1}").assertValid("bar")) .isInstanceOf(IllegalArgumentException.class) .hasMessage("bar is not foo"); }); }