Results 1 to 3 of 3

Thread: java.util.Currency field generated with --notNull constraint breaks generated tests

  1. #1

    Default java.util.Currency field generated with --notNull constraint breaks generated tests

    If an entity field with type java.util.Currency is created like this:
    Code:
    project --topLevelPackage com.example --projectName example --java 6
    jpa setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY 
    entity jpa --class com.example.AccountingTransaction --testAutomatically 
    field other --fieldName currency --type java.util.Currency --notNull
    the automated tests fail because of the @NotNull constraint on this field:
    Code:
     
    testCountAccountingTransactions(com.example.AccountingTransactionIntegrationTest): [ConstraintDescriptorImpl{annotation=javax.validation.constraints.NotNull, payloads=[], hasComposingConstraints=true, isReportAsSingleInvalidConstraint=false, elementType=FIELD, definedOn=DEFINED_LOCALLY, groups=[interface javax.validation.groups.Default], attributes={message={javax.validation.constraints.NotNull.message}, payload=[Ljava.lang.Class;@3cd713fe, groups=[Ljava.lang.Class;@4c61a7e6}}:kann nicht null sein=null]
    This is because of the following generated implementation in aspect AccountingTransactionDataOnDemand_Roo_DataOnDemand :
    Code:
        public void AccountingTransactionDataOnDemand.setCurrency(AccountingTransaction obj, int index) {
            Currency currency = null;
            obj.setCurrency(currency);
        }
    How can this be fixed properly without modifying the generated aspect myself?

  2. #2
    Join Date
    Jan 2010
    Location
    Mislata - Valencia - Spain
    Posts
    162

    Default

    Quote Originally Posted by Andreas Klöber View Post
    How can this be fixed properly without modifying the generated aspect myself?
    Make a push-in of setCurrency method and modify it.

    Regards !
    Mario Martínez Sánchez
    Project Manager & Software Architect
    --------------------------
    Disid Technologies S.L.
    http://www.disid.com
    --------------------------
    gvNIX
    http://gvnix.googlecode.com
    http://www.gvnix.org

  3. #3

    Default

    Quote Originally Posted by mmartinez View Post
    Make a push-in of setCurrency method and modify it.
    Thanks, that worked!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •