I have two integration tests. I'm trying to use a dynamic finder in both on a class called RoutingLane. The second test fails with the MissingMethodException.
Failure: testMockRouteLane2(compliance.processor.services.CalculationServiceTests)
groovy.lang.MissingMethodException: No signature of method: RoutingLane.methodMissing() is applicable for argument types: () values: []
The mock functions are:
void testMockRouteLane() {
def routingLaneMock = RoutingLane.findAllByMot('TL')
assert routingLaneMock != null
assert routingLaneMock.size() >= 1
}
void testMockRouteLane2() {
def routingLaneMock = RoutingLane.findAllByMot('TL')
assert routingLaneMock != null
assert routingLaneMock.size() >= 1
}
What could be the cause?
I wanted to answer my own question, since I have discovered the issue, thanks to reading another thread.
Grails integration tests with multiple services
It was due to me converting this to an integration test from a unit test, and not removing the @TestFor
annotation for the service class name.
Hopefully this helps anyone else that encounters the issue.