Search in sources :

Example 6 with SizeValidator

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

the class SizeValidatorTest method testEqualsSelf.

@Test
public void testEqualsSelf() {
    final SizeValidator validator = new SizeValidator(13, 1799);
    assertThat(validator.equals(validator), is(true));
}
Also used : SizeValidator(ddf.catalog.validation.impl.validator.SizeValidator) Test(org.junit.Test)

Example 7 with SizeValidator

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

the class SizeValidatorTest method testHashCode.

@Test
public void testHashCode() {
    final SizeValidator validator1 = new SizeValidator(13, 1799);
    final SizeValidator validator2 = new SizeValidator(13, 1799);
    assertThat(validator1.hashCode(), is(validator2.hashCode()));
}
Also used : SizeValidator(ddf.catalog.validation.impl.validator.SizeValidator) Test(org.junit.Test)

Example 8 with SizeValidator

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

the class SizeValidatorTest method testEqualsDifferentMax.

@Test
public void testEqualsDifferentMax() {
    final SizeValidator validator1 = new SizeValidator(13, 1799);
    final SizeValidator validator2 = new SizeValidator(13, 2000);
    assertThat(validator1.equals(validator2), is(false));
    assertThat(validator2.equals(validator1), is(false));
}
Also used : SizeValidator(ddf.catalog.validation.impl.validator.SizeValidator) Test(org.junit.Test)

Example 9 with SizeValidator

use of ddf.catalog.validation.impl.validator.SizeValidator 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

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