For testing java code with groovy, object graph builder is amazing:
def company = builder.company( name: 'ACME' ) {
address( id: 'a1', line1: '123 Groovy Rd', zip: 12345, state: 'JV' )
employee( name: 'Duke', employeeId: 1 ){
address( refId: 'a1' )
}
}
Standard feature, but still really nice.
ObjectGraphBuilder
(You do need to give any properties of your POJO that are Lists a default value of an empty list rather than null for builder support to work.)