Five quick points about unit tests that will reduce your defect rates.
Always stop to add that simple unit test. You will be amazed how often this discovers a bug or unexplored corner case.
Never develop from a main method, find a way to turn it into a test. Main driven development is horrible, they are not [...]
Google have a nice equals method to make boiler plate equals easier to read. Particularly good if you have many attributes in the method. http://publicobject.com/2007/09/coding-in-small-with-google-collections_8175.html
Be careful to check that your objects are consistent with equals though. I have mentioned this before.
I have found that quite a few programmers struggle to work in a completely test driven fashion. I myself whilst writing tests for many years, took a long time to move over to writing the test first. I think one of my problems was that I always wanted to do my thinking in [...]
In a previous post I looked at Unitils. This is a quick update: Yes its great but the product could do with some polish, better documentation, bug fixing and some api revision. Despite that its still the best system I have looked at to test a DAO. Also the project is alive and kicking, it looks like there is more to come in future revisions. See the full post for more detail.
I wanted to explore unit testing JPA DAO and models. Hand crafting solutions is quite time consuming. I found something called Unitils which refines another project Dbunit. In theory it should significantly reduce the complexity and save some time. So one Saturday, I sat down to explore the space and write this blog.