I am trying to update my test since I made a change on my service class. In a service method I added ("withNewSession")
Domain.withNewSession {
.. ...
domain.save()
}
Since I am using the "withNewSession", I am getting method missing exception as this Domain is mocked in my test class.
withNewSession method is not allowed by unit testing. Use inside your test class:
@org.junit.Before
void before() {
DomainClazz.metaClass.static.withNewSession = {Closure c -> c.call() }
}