Grails3 unit test for domain class with derived property
问题 I have the following Domain class with derived property lowercaseTag . class Hashtag { String tag String lowercaseTag static mapping = { lowercaseTag formula: 'lower(tag)' } } If I run the following unit test, it will fail on the last line, because lowercaseTag property is null and by default all properties have nullable: false constraint. @TestFor(Hashtag) class HashtagSpec extends Specification { void "Test that hashtag can not be null"() { when: 'the hashtag is null' def p = new Hashtag