Search in sources :

Example 1 with EnumerationValidator

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

the class EnumerationValidatorTest method testHashCodeDifferentEnumerationValues.

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

Example 2 with EnumerationValidator

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

the class EnumerationValidatorTest method getReport.

private Optional<AttributeValidationReport> getReport(boolean ignoreCase, final Attribute attribute) {
    final Set<String> enumeratedValuesSet = Arrays.stream(ENUMERATED_VALUES).collect(Collectors.toSet());
    final EnumerationValidator validator = new EnumerationValidator(enumeratedValuesSet, ignoreCase);
    return validator.validate(attribute);
}
Also used : EnumerationValidator(ddf.catalog.validation.impl.validator.EnumerationValidator)

Example 3 with EnumerationValidator

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

the class EnumerationValidatorTest method testEqualsDifferentEnumerationValues.

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

Example 4 with EnumerationValidator

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

the class EnumerationValidatorTest method testEqualsNull.

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

Example 5 with EnumerationValidator

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

the class EnumerationValidatorTest method testEquals.

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

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