In my service, the grailsApplication instance is auto injected and it is used to look up the domain name as follows:
grailsApplication.getDomainClass(domain.getClass().name)?.clazz
How to mock this in the unit test. So far, i have been doing something like:
def getDomainClass = {
assert null
}
def grailsApplication = [getDomainClass: getDomainClass]
service.grailsApplication = {grailsApplication as GrailsApplication}
However, this doesn't work. It appears, we are getting following error:
interface org.springframework.validation.Errors
Any suggestions how to mock it? Thank You