If you want to perform integration tests of code that accesses the database, you can use DBUnit . DBUnit can load test data into the database before each test. This can help compare the result of the test case with the expected set of values.
source
share