0

My case is that I have two tables which one table has foreign key constraint to the other, and the reference is the other table's field 'id' which will auto increment with every insert, and cannot be omitted for this reference relation, and when I run unit test to test DAO's save(INSERT) method, the comparisonFailure occured for the 'id' is not match(expect 1 but real value is more than 1 and increasing by every run).

How to deal with this case?

1
  • the 'id' of the table be referenced cannot be omitted. Commented Oct 12, 2017 at 2:06

1 Answer 1

0

Use the dbUnit feature to ignore columns in the comparison.

For example, DefaultPrepAndExpectedTestCase.runTest(...) has a parameter "verifyTables" which is type VerifyTableDefinition and has a constructor parameter "excludeColumns".

Directly, can use one of the "exclude column" methods on DefaultColumnFilter, such as excludedColumnsTable(table, columnNames).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.