Posts

Showing posts from January, 2009

Custom Foil Hats

Image
My oldest son wants to announce the launch of online sales of his newest product, Foil Hats. These hats are certified to protect your thoughts from prying government spooks, and brainwave stealing aliens. These hats are custom made to your measurements (up to US hat size 8), for just $3.99 (US). Simply comment on this blog entry, and we can coordinate payment/shipment over more secure channels.

Rollback DB Changes in Unit Tests with Spring

Observation 1: Applications are written human beings, which tend to make mistakes. It's a good idea to have some tools in place to help catch those mistakes early by validating assumptions against reality. One such tool is unit testing. Observation 2: Almost every application out there needs access to some kind of persistent data storage. In a lot of application code, that storage mechanism is some kind of relational database. It is easy to understand, based on the situations described above, that unit testing tools should take into account handling initializing persistent storage systems properly for testing. Thankfully, JUnit has some extensions to make unit testing with a particular set of data in the relational DB easier. DBUnit provides a way to represent test relational data in an XML form that is human readable, and can be loaded into most any JDBC data source. DBUnit's strategy is to reset the database to a known good base state before each unit test runs. I