Search in sources :

Example 1 with ConfigurationValidator

use of org.revapi.configuration.ConfigurationValidator in project revapi by revapi.

the class ConfigurableElementFilterTest method testInvalidConfig_noFilters.

@Test
public void testInvalidConfig_noFilters() throws Exception {
    ConfigurationValidator validator = new ConfigurationValidator();
    String json = "[{\"extension\": \"revapi.filter\", \"configuration\" : { }}]";
    ValidationResult result = validator.validate(ModelNode.fromJSONString(json), new ConfigurableElementFilter());
    Assert.assertFalse(result.isSuccessful());
}
Also used : ConfigurationValidator(org.revapi.configuration.ConfigurationValidator) ValidationResult(org.revapi.configuration.ValidationResult) Test(org.junit.Test)

Example 2 with ConfigurationValidator

use of org.revapi.configuration.ConfigurationValidator in project revapi by revapi.

the class ConfigurableElementFilterTest method testInvalidConfig_noDefsForFilter.

@Test
public void testInvalidConfig_noDefsForFilter() throws Exception {
    ConfigurationValidator validator = new ConfigurationValidator();
    String json = "[{\"extension\": \"revapi.filter\", \"configuration\" : { \"elements\" : { \"include\" : [] }}}]";
    ValidationResult result = validator.validate(ModelNode.fromJSONString(json), new ConfigurableElementFilter());
    Assert.assertFalse(result.isSuccessful());
    json = "[{\"extension\": \"revapi.filter\", \"configuration\": { \"elements\" : { \"exclude\" : [] }}}]";
    result = validator.validate(ModelNode.fromJSONString(json), new ConfigurableElementFilter());
    Assert.assertFalse(result.isSuccessful());
    json = "[{\"extension\": \"revapi.filter\", \"configuration\": { \"archives\" : { \"exclude\" : {} }}}]";
    result = validator.validate(ModelNode.fromJSONString(json), new ConfigurableElementFilter());
    Assert.assertFalse(result.isSuccessful());
}
Also used : ConfigurationValidator(org.revapi.configuration.ConfigurationValidator) ValidationResult(org.revapi.configuration.ValidationResult) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 ConfigurationValidator (org.revapi.configuration.ConfigurationValidator)2 ValidationResult (org.revapi.configuration.ValidationResult)2