예제 #1
0
  @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());
  }
예제 #2
0
  @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());
  }