Search in sources :

Example 11 with AttributeValidationReport

use of ddf.catalog.validation.report.AttributeValidationReport in project ddf by codice.

the class PatternValidatorTest method validateNoErrors.

private void validateNoErrors(final String value) {
    final Optional<AttributeValidationReport> reportOptional = VALIDATOR.validate(new AttributeImpl("test", value));
    assertThat(reportOptional.isPresent(), is(false));
}
Also used : AttributeImpl(ddf.catalog.data.impl.AttributeImpl) AttributeValidationReport(ddf.catalog.validation.report.AttributeValidationReport)

Example 12 with AttributeValidationReport

use of ddf.catalog.validation.report.AttributeValidationReport in project ddf by codice.

the class PatternValidatorTest method validateWithErrors.

private void validateWithErrors(final String value, final int expectedErrors) {
    final Optional<AttributeValidationReport> reportOptional = VALIDATOR.validate(new AttributeImpl("test", value));
    assertThat(reportOptional.get().getAttributeValidationViolations(), hasSize(expectedErrors));
}
Also used : AttributeImpl(ddf.catalog.data.impl.AttributeImpl) AttributeValidationReport(ddf.catalog.validation.report.AttributeValidationReport)

Aggregations

AttributeValidationReport (ddf.catalog.validation.report.AttributeValidationReport)12 AttributeImpl (ddf.catalog.data.impl.AttributeImpl)8 AttributeValidator (ddf.catalog.validation.AttributeValidator)2 ISO3CountryCodeValidator (ddf.catalog.validation.impl.validator.ISO3CountryCodeValidator)2 ValidationViolation (ddf.catalog.validation.violation.ValidationViolation)2 Optional (java.util.Optional)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 Preconditions (com.google.common.base.Preconditions)1 Attribute (ddf.catalog.data.Attribute)1 Metacard (ddf.catalog.data.Metacard)1 FederationException (ddf.catalog.federation.FederationException)1 SourceUnavailableException (ddf.catalog.source.SourceUnavailableException)1 UnsupportedQueryException (ddf.catalog.source.UnsupportedQueryException)1 AttributeValidatorRegistry (ddf.catalog.validation.AttributeValidatorRegistry)1 ReportingMetacardValidator (ddf.catalog.validation.ReportingMetacardValidator)1 AttributeValidationReportImpl (ddf.catalog.validation.impl.report.AttributeValidationReportImpl)1 ValidationViolationImpl (ddf.catalog.validation.impl.violation.ValidationViolationImpl)1 MetacardValidationReport (ddf.catalog.validation.report.MetacardValidationReport)1 ArrayList (java.util.ArrayList)1