use of ddf.catalog.validation.impl.validator.RangeValidator in project ddf by codice.
the class RangeValidatorTest method testHashCodeDifferentMin.
@Test
public void testHashCodeDifferentMin() {
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.hashCode(), not(validator2.hashCode()));
}
use of ddf.catalog.validation.impl.validator.RangeValidator in project ddf by codice.
the class RangeValidatorTest method testEquals.
@Test
public void testEquals() {
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.5"));
assertThat(validator1.equals(validator2), is(true));
assertThat(validator2.equals(validator1), is(true));
}
use of ddf.catalog.validation.impl.validator.RangeValidator in project ddf by codice.
the class RangeValidatorTest method testWithinLargeDecimalRange.
@Test
public void testWithinLargeDecimalRange() {
final RangeValidator validator = new RangeValidator(new BigDecimal("-123456789123456.857"), new BigDecimal("987654321987654.923"), new BigDecimal("0.01"));
validateNoErrors(new AttributeImpl("", -123456789123456.857), validator);
validateNoErrors(new AttributeImpl("", 987654321987654.923), validator);
validateNoErrors(new AttributeImpl("", 0), validator);
validateNoErrors(new AttributeImpl("", -123456789123456L), validator);
validateNoErrors(new AttributeImpl("", 987654321987654L), validator);
}
use of ddf.catalog.validation.impl.validator.RangeValidator in project ddf by codice.
the class RangeValidatorTest method testOutsideLargeDecimalRange.
@Test
public void testOutsideLargeDecimalRange() {
final RangeValidator validator = new RangeValidator(new BigDecimal("-123456789123456.857"), new BigDecimal("987654321987654.923"), new BigDecimal("0.01"));
validateWithErrors(new AttributeImpl("", -123456789123456.87), validator, 1);
validateWithErrors(new AttributeImpl("", 987654321987654.94), validator, 1);
validateWithErrors(new AttributeImpl("", -123456789123457L), validator, 1);
validateWithErrors(new AttributeImpl("", 987654321987655L), validator, 1);
}
use of ddf.catalog.validation.impl.validator.RangeValidator in project ddf by codice.
the class RangeValidatorTest method testOutsideSmallDecimalRange.
@Test
public void testOutsideSmallDecimalRange() {
final RangeValidator validator = new RangeValidator(new BigDecimal("1.2457515"), new BigDecimal("1.2487595"), new BigDecimal("1E-7"));
validateWithErrors(new AttributeImpl("", 1.24575135), validator, 1);
validateWithErrors(new AttributeImpl("", 1.24875965), validator, 1);
validateWithErrors(new AttributeImpl("", 1), validator, 1);
validateWithErrors(new AttributeImpl("", 2), validator, 1);
}
Aggregations