Today I tried to create a unit test for a DAO class. I had to keep on refactoring the code until I can write simple test for it:
- Simple mock object.
- Easily definition of the purpose in test.
The test itself turned out to be very trivial, but the source code for the business logic make a lot better sense to me and others.