I am updating the application from Grails 2.4.4 to Grails 3.0.9, and I cannot find any information on how to do mockFor, createMock and requirements in Grails 3.
I used to do things like this:
fooService = mockFor(FooService)
controller.fooService = fooService.createMock()
fooService.demand.barMethod() { a,b ->
}
But it looks like "mockFor" just left, even from the documentation. What is the Grails 3 way?
UPDATE:
I donโt want to rewrite thousands of tests written by Grails 'mockFor' style in Spock's interaction style, so I came up with this solution:
- replace mockFor () with the new MockFor ()
- replace createMock () with proxyInstance ()
- move calls to fooBean.fooService = fooService.proxyInstance () after requirements
Without further changes, this โjust worksโ in Grails 3.