I have a simple requirement in my unit test run to run integration tests on my java application's persistence layer.

Each test must (1) create the schema, (2) insert the fresh test data, (3) run the test and (4) clean up and remove the database.

Have a look at CleanDatabaseTestSetup.java in the Derby source tree.
Derby's built-in JUnit tests do almost the same thing as you describe,
so it is a very common pattern in that code.

Browse around there and you should find some good examples of coding
patterns for these tasks.

thanks,

bryan

Reply via email to