use of ddf.catalog.data.impl.AttributeImpl 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.data.impl.AttributeImpl 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);
}
use of ddf.catalog.data.impl.AttributeImpl 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.data.impl.AttributeImpl 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.data.impl.AttributeImpl in project ddf by codice.
the class RequiredAttributesMetacardValidatorTest method testValidMetacard.
@Test
public void testValidMetacard() {
final Metacard metacard = new MetacardImpl();
metacard.setAttribute(new AttributeImpl("title", "test"));
metacard.setAttribute(new AttributeImpl("created", new Date()));
metacard.setAttribute(new AttributeImpl("thumbnail", new byte[] { 1, 2, 3, 4 }));
validateNoErrors(metacard, Sets.newHashSet("title", "created", "thumbnail"));
}
Aggregations