thinair Boulder, Colorado. elevation 5400 feet.

Test-driven code duplication

Thursday, I was test driving a DAO. At the moment it's almost entirely pseudo implementation -- no actual SQL. The interface is already designed, I get to write the SQL.

Unit testing the SQL is causing code duplication. I'm using EasyMock objects for the Connection, Statement, PrepairedStatement, and ResultSet. I end up basically writing the implementation in the test and then writing it again in the DAO. Something stinks. I think it has to do with the way EasyMock sets expectations. It would look differently if I used MockObjects, or if I rolled my own mocks. But EasyMock saves me the extra work of writing and maintaining the mock objects.

I want these tests to be independent of the database.