@Test
public void testValidateConfigurationOption() throws Exception {

	final ConfigurationOption<Boolean> configurationOption = ConfigurationOption.booleanOption()
			.key("foo")
			.addValidator((value) -> {
				if (!value) {
					throw new IllegalArgumentException("Validation failed");
				}
			})
			.buildWithDefault(true);
	final ConfigurationOptionProvider optionProvider = TestConfigurationOptionProvider.of(configurationOption);
	final SimpleSource configurationSource = new SimpleSource("test");
	final ConfigurationRegistry config = ConfigurationRegistry.builder()
			.addOptionProvider(optionProvider)
			.addConfigSource(configurationSource)
			.build();
	try {
		config.save("foo", "false", "test");
		fail();
	} catch (IllegalArgumentException e) {
		assertEquals("Validation failed", e.getMessage());
	}
}