@Test public void testGenerateDomainCustomConstraintDomain() { Domain dom = MVCoreFactoryImpl.eINSTANCE.createDomain(); dom.setName("Person"); Attribute attr = MVCoreFactoryImpl.eINSTANCE.createAttribute(); attr.setName("age"); attr.setType(getDataTypeFor("int")); dom.getAttributes().add(attr); Attribute attr2 = MVCoreFactoryImpl.eINSTANCE.createAttribute(); attr2.setName("shoesize"); attr2.setType(getDataTypeFor("int")); dom.getAttributes().add(attr2); Constraint constr = MVCoreFactoryImpl.eINSTANCE.createConstraint(); constr.setType(ConstraintType.CUSTOM_CONSTRAINT); constr.setValue("age(validator: {shoesize + age < 100})"); dom.getConstraints().add(constr); GrailsGenerator gen = new GrailsGenerator(); String s = gen.buildEDomainClass(dom, "test"); assertTrue(s.contains("age(validator: {shoesize + age < 100})")); }