Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-2027

@DecimalMax constraint not honored in RooDataOnDemand tests

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 1.1.2.RELEASE
    • Fix Version/s: 1.1.2.RELEASE
    • Component/s: PERSISTENCE
    • Labels:
      None

      Description

      Define an entity with the following field and generate the DoD driven integration tests:

          @NotNull
          @DecimalMin("0.0")
          @DecimalMax("9999.99")
          @Digits(integer = 5, fraction = 2)
          private BigDecimal myNum;
      

      Next, run the integration tests. The testPersist() method will fail with a constraint violation. The test uses Integer.MAX_VALUE as the value for the index in getRandomEntityName(). The DoD class then uses the index to construct the BigDecimal, even though the annotation above set the max decimal amount to "9999.99".

              obj.setMyNum(new java.math.BigDecimal(index));
      

      This does not happen with integer fields - the annotation is used to limit the maximum value to the value specified by the maximum value.

        Attachments

          Activity

            People

            • Assignee:
              stewarta Alan Stewart
              Reporter:
              krimple Ken Rimple
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: