Search in sources :

Example 6 with EnumerationValidator

use of ddf.catalog.validation.impl.validator.EnumerationValidator in project ddf by codice.

the class EnumerationValidatorTest method testHashCode.

@Test
public void testHashCode() {
    final EnumerationValidator validator1 = new EnumerationValidator(Sets.newHashSet("first", "second"), false);
    final EnumerationValidator validator2 = new EnumerationValidator(Sets.newHashSet("first", "second"), false);
    assertThat(validator1.hashCode(), is(validator2.hashCode()));
}
Also used : EnumerationValidator(ddf.catalog.validation.impl.validator.EnumerationValidator) Test(org.junit.Test)

Example 7 with EnumerationValidator

use of ddf.catalog.validation.impl.validator.EnumerationValidator in project ddf by codice.

the class EnumerationValidatorTest method testEqualsSelf.

@Test
public void testEqualsSelf() {
    final EnumerationValidator validator = new EnumerationValidator(Sets.newHashSet("first"), false);
    assertThat(validator.equals(validator), is(true));
}
Also used : EnumerationValidator(ddf.catalog.validation.impl.validator.EnumerationValidator) Test(org.junit.Test)

Example 8 with EnumerationValidator

use of ddf.catalog.validation.impl.validator.EnumerationValidator in project ddf by codice.

the class ReportingMetacardValidatorImplTest method registerValidators.

private void registerValidators() {
    registry.registerValidators(Metacard.TITLE, Sets.newHashSet(new SizeValidator(1, 20), new PatternValidator("[A-Z]+")));
    registry.registerValidators(Metacard.MODIFIED, Sets.newHashSet(PastDateValidator.getInstance()));
    registry.registerValidators(Metacard.EFFECTIVE, Sets.newHashSet(FutureDateValidator.getInstance()));
    final EnumerationValidator enumerationValidator = new EnumerationValidator(Sets.newHashSet("application/xml", "text/xml"), false);
    registry.registerValidators(Metacard.CONTENT_TYPE, Sets.newHashSet(enumerationValidator));
}
Also used : EnumerationValidator(ddf.catalog.validation.impl.validator.EnumerationValidator) SizeValidator(ddf.catalog.validation.impl.validator.SizeValidator) PatternValidator(ddf.catalog.validation.impl.validator.PatternValidator)

Aggregations

EnumerationValidator (ddf.catalog.validation.impl.validator.EnumerationValidator)8 Test (org.junit.Test)6 PatternValidator (ddf.catalog.validation.impl.validator.PatternValidator)1 SizeValidator (ddf.catalog.validation.impl.validator.SizeValidator)1