use of ddf.catalog.validation.impl.validator.RangeValidator in project ddf by codice.
the class RangeValidatorTest method testOutsideIntegerRange.
@Test
public void testOutsideIntegerRange() {
final RangeValidator validator = new RangeValidator(new BigDecimal("-123456789123456"), new BigDecimal("987654321987654"));
validateWithErrors(new AttributeImpl("", -123456789123457L), validator, 1);
validateWithErrors(new AttributeImpl("", 987654321987655L), validator, 1);
validateWithErrors(new AttributeImpl("", -123456789123456.1), validator, 1);
validateWithErrors(new AttributeImpl("", 987654321987654.1), validator, 1);
}
use of ddf.catalog.validation.impl.validator.RangeValidator in project ddf by codice.
the class RangeValidatorTest method testEqualsDifferentMin.
@Test
public void testEqualsDifferentMin() {
final RangeValidator validator1 = new RangeValidator(new BigDecimal("1.5"), new BigDecimal("2.5"));
final RangeValidator validator2 = new RangeValidator(new BigDecimal("1.1"), new BigDecimal("2.5"));
assertThat(validator1.equals(validator2), is(false));
assertThat(validator2.equals(validator1), is(false));
}
use of ddf.catalog.validation.impl.validator.RangeValidator in project ddf by codice.
the class RangeValidatorTest method testEqualsDifferentMax.
@Test
public void testEqualsDifferentMax() {
final RangeValidator validator1 = new RangeValidator(new BigDecimal("1.5"), new BigDecimal("2.5"));
final RangeValidator validator2 = new RangeValidator(new BigDecimal("1.5"), new BigDecimal("2.1"));
assertThat(validator1.equals(validator2), is(false));
assertThat(validator2.equals(validator1), is(false));
}
use of ddf.catalog.validation.impl.validator.RangeValidator in project ddf by codice.
the class RangeValidatorTest method testWithinIntegerRange.
@Test
public void testWithinIntegerRange() {
final RangeValidator validator = new RangeValidator(new BigDecimal("-123456789123456"), new BigDecimal("987654321987654"));
validateNoErrors(new AttributeImpl("", -123456789123456L), validator);
validateNoErrors(new AttributeImpl("", 987654321987654L), validator);
validateNoErrors(new AttributeImpl("", 0), validator);
validateNoErrors(new AttributeImpl("", -123456789123455.9), validator);
validateNoErrors(new AttributeImpl("", 987654321987653.9), validator);
}
use of ddf.catalog.validation.impl.validator.RangeValidator in project ddf by codice.
the class RangeValidatorTest method testEqualsNull.
@Test
public void testEqualsNull() {
final RangeValidator validator = new RangeValidator(new BigDecimal("1.5"), new BigDecimal("2.5"));
assertThat(validator.equals(null), is(false));
}
Aggregations