Friday, April 23, 2010

Populate a DTO with mock data

Problem:
Every so often i need to have a list of some simple DTOs in order to build a screen. The DTOs need to be populated from the database, but the query is not ready. Its somewhat painful to write dummy data creation methods over and over again.

Solution:
Using Groovy(though not required), Spring and a bit of reflection i cover most of the simple DTOs.



To use, pass the class a list of which you expect

No comments:

Post a Comment