I would advise against testing getErrorCount(), as your tests will be fragile (since you add other restrictions, you will not have to update each instance new BlogPost()anywhere in the test cases). Just check hasErrors().
In addition to this ... for each restriction, you need to generate some test data that violate it, call the verification procedure and confirm the errors. This is the code you need.
. :
private void assertConstraintWorks(clazz, fieldName, testData, expectedErrorCode) {
def instance = clazz.newInstance((fieldName): testData)
assertFalse instance.validate()
assertTrue instance.hasErrors()
assertEquals expectedErrorCode, instance.errors?.getFieldError(fieldName)?.code
}
void testConstraints() {
assertConstraintWorks BlogPost, 'title', '', 'blank'
assertConstraintWorks BlogPost, 'text', '', 'blank'
assertConstraintWorks BlogPost, 'text', ObjectMother.bigText(2001), 'maxSize.exceeded'
}