简体   繁体   中英

Ignore columns in ExpectedDataSet (dbunit)

How can I ignore the comparison of some columns using ExpectedDataSet annotation?

  • I use dbunit API.

In spring using spring-test-dbunit, you can write:

@ExpectedDatabase(value="yourdataset.xml", assertionMode=DatabaseAssertionMode.NON_STRICT)

and omit the columns on "yourdataset.xml"

ref: http://springtestdbunit.github.io/spring-test-dbunit/

I have the same probleme, ommiting column is not working for my case. I have two tables organizations and customers , customer email should be unique by organization.

<organizations
            id='4e332e3d-fc13-4e39-91dd-53825c71b9b2'
    ...
/>
<organizations
            id='ca9484a6-70a3-4b7d-b6da-4528152684bf'
    ...
/>
 <individual_customers
            id="9892be6a-ca10-49eb-9616-33cf03a24e63"
            organization_reference="4e332e3d-fc13-4e39-91dd-53825c71b9b2"
 />

when instering the new customer, I expect to have a new customer, but I dont know the new inserted id. I get this error message value (table=individual_customers, row=0, col=id) expected:<[null]> but was:<[47d89697-c2fe-42a0-8d9c-fc4b5b0aaaa0]>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM