@Test() public void testValidateWithInteger() { longRangeValidator.setMax(100L); longRangeValidator.setMin(10L); ValidatorMessage message = (ValidatorMessage) longRangeValidator.validate(new Integer(21), "label"); assertEquals(false, message.hasError()); message = (ValidatorMessage) longRangeValidator.validate(new Integer(101), "label"); assertEquals(true, message.hasError()); message = (ValidatorMessage) longRangeValidator.validate(new Integer(9), "label"); assertEquals(true, message.hasError()); }
@Test() public void testValidateWithLong() { longRangeValidator.setMax(100L); longRangeValidator.setMin(10L); ValidatorMessage message = (ValidatorMessage) longRangeValidator.validate(new Long(21), "label"); assertEquals(false, message.hasError()); message = (ValidatorMessage) longRangeValidator.validate(new Long(101), "label"); assertEquals(true, message.hasError()); message = (ValidatorMessage) longRangeValidator.validate(new Long(9), "label"); assertEquals(true, message.hasError()); // ystem.out.println(message.getDetail()); // ystem.out.println(message.getSummary()); }
@BeforeMethod protected void setUp() throws Exception { longRangeValidator = new LongRangeValidator(); longRangeValidator.setResourceBundleLocator(resourceBundleLocator); longRangeValidator.init(); }