Search in sources :

Example 11 with RangeValidator

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

the class RangeValidatorTest method testEqualsSelf.

@Test
public void testEqualsSelf() {
    final RangeValidator validator = new RangeValidator(new BigDecimal("1.5"), new BigDecimal("2.5"));
    assertThat(validator.equals(validator), is(true));
}
Also used : RangeValidator(ddf.catalog.validation.impl.validator.RangeValidator) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 12 with RangeValidator

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

the class RangeValidatorTest method testHashCode.

@Test
public void testHashCode() {
    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.hashCode(), is(validator2.hashCode()));
}
Also used : RangeValidator(ddf.catalog.validation.impl.validator.RangeValidator) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 13 with RangeValidator

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

the class RangeValidatorTest method testHashCodeDifferentMax.

@Test
public void testHashCodeDifferentMax() {
    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.hashCode(), not(validator2.hashCode()));
}
Also used : RangeValidator(ddf.catalog.validation.impl.validator.RangeValidator) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 14 with RangeValidator

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

the class RangeValidatorTest method testWithinSmallDecimalRange.

@Test
public void testWithinSmallDecimalRange() {
    final RangeValidator validator = new RangeValidator(new BigDecimal("1.2457515"), new BigDecimal("1.2487595"), new BigDecimal("1E-7"));
    validateNoErrors(new AttributeImpl("", 1.2457515), validator);
    validateNoErrors(new AttributeImpl("", 1.2487595), validator);
    validateNoErrors(new AttributeImpl("", 1.246), validator);
}
Also used : AttributeImpl(ddf.catalog.data.impl.AttributeImpl) RangeValidator(ddf.catalog.validation.impl.validator.RangeValidator) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Aggregations

RangeValidator (ddf.catalog.validation.impl.validator.RangeValidator)14 BigDecimal (java.math.BigDecimal)14 Test (org.junit.Test)14 AttributeImpl (ddf.catalog.data.impl.AttributeImpl)6