コード例 #1
0
  @Test
  public void testIsValidDecimalMax() {

    AnnotationDescriptor<DecimalMax> descriptor =
        new AnnotationDescriptor<DecimalMax>(DecimalMax.class);
    descriptor.setValue("value", "15.0E0");
    descriptor.setValue("message", "{validator.max}");
    DecimalMax m = AnnotationFactory.create(descriptor);

    DecimalMaxValidatorForCharSequence constraint = new DecimalMaxValidatorForCharSequence();
    constraint.initialize(m);
    testMaxValidator(constraint, true);
  }
コード例 #2
0
  @Test
  @TestForIssue(jiraKey = "HV-256")
  public void testIsValidDecimalMaxExclusive() {
    boolean inclusive = false;
    AnnotationDescriptor<DecimalMax> descriptor =
        new AnnotationDescriptor<DecimalMax>(DecimalMax.class);
    descriptor.setValue("value", "15.0E0");
    descriptor.setValue("inclusive", inclusive);
    descriptor.setValue("message", "{validator.max}");
    DecimalMax m = AnnotationFactory.create(descriptor);

    DecimalMaxValidatorForCharSequence constraint = new DecimalMaxValidatorForCharSequence();
    constraint.initialize(m);
    testMaxValidator(constraint, inclusive);
  }