{
IntakeService is = (IntakeService) this.resolve( IntakeService.class.getName() );
Group group = is.getGroup("NumberTest");
assertNotNull(group);
Field intField = group.get("EmptyIntegerTestField");
try
{
intField.getValidator().assertValidity("aa");
}
catch (ValidationException ve)
{
assertEquals("Invalid number message is wrong.", "Entry was not a valid Integer", ve.getMessage());
}
Field longField = group.get("EmptyLongTestField");
try
{
longField.getValidator().assertValidity("aa");
}
catch (ValidationException ve)
{
assertEquals("Invalid number message is wrong.", "Entry was not a valid Long", ve.getMessage());
}
Field shortField = group.get("EmptyShortTestField");
try
{
shortField.getValidator().assertValidity("aa");
}
catch (ValidationException ve)
{
assertEquals("Invalid number message is wrong.", "Entry was not a valid Short", ve.getMessage());
}
Field floatField = group.get("EmptyFloatTestField");
try
{
floatField.getValidator().assertValidity("aa");
}
catch (ValidationException ve)
{
assertEquals("Invalid number message is wrong.", "Entry was not a valid Float", ve.getMessage());
}
Field doubleField = group.get("EmptyDoubleTestField");
try
{
doubleField.getValidator().assertValidity("aa");
}
catch (ValidationException ve)
{
assertEquals("Invalid number message is wrong.", "Entry was not a valid Double", ve.getMessage());
}
Field bigDecimalField = group.get("EmptyBigDecimalTestField");
try
{
bigDecimalField.getValidator().assertValidity("aa");
}
catch (ValidationException ve)
{
assertEquals("Invalid number message is wrong.", "Entry was not a valid BigDecimal", ve.getMessage());
}
Field numberField = group.get("NumberTestField");
try
{
numberField.getValidator().assertValidity("aa");
}
catch (ValidationException ve)
{
assertEquals("Invalid number message is wrong.", "Not a number", ve.getMessage());
}