0
votes

If I were to annotate my DAO integration test methods with @Transactional, Spring Test will happily rollback any changes to the database after each test methods completes. These seems extremely convenient, because I can load the test data once with a @BeforeClass method and all clean up is handled for me.

But I question whether this is a good practice because I'd be missed the opportunity to uncover failures that would occur during a commit. Whats the consensus on using transactions in dbunit integration tests of DAOs to help with clean up??

1

1 Answers

2
votes

This is perfectly fine. You will perform write operations on your unit-tests, and the DB will verify those operations. They won't be committed, but this last step would never fail because of business logic, so you should not worry about that.