<%if (packageName){%>${packageName}<%}%> import grails.test.GrailsUnitTestCase class ${className}UnitTests extends GrailsUnitTestCase { ${className} ${domainClass.propertyName} void setUp() { super.setUp() // in testing-plugin 0.4 you can just do "mockForConstraintsTests(${className})" instead of these two lines registerMetaClass(${className}) grails.test.MockUtils.prepareForConstraintsTests(${className}) // TODO - fill out this ${domainClass.propertyName} instance so it validates ${domainClass.propertyName} = new ${className}() assertTrue "setup method: ${domainClass.propertyName} should validate", ${domainClass.propertyName}.validate() } <% domainClass.constrainedProperties.each { propertyName, constrainedProperty -> %> void test${org.apache.commons.lang.StringUtils.capitalize(propertyName)}Constriants() { <% constrainedProperty.appliedConstraints.each { constraint -> %> //test ${constraint} <% } %> } <% } %> }