对grails中动态查找程序的后续调用将导致groovy.lang.MissingMethodException

对grails中动态查找程序的后续调用将导致groovy.lang.MissingMethodException,grails,gorm,Grails,Gorm,我有两个集成测试。我试图在一个名为RoutingLane的类中使用动态查找器。第二个测试失败,出现MissingMethodException Failure: testMockRouteLane2(compliance.processor.services.CalculationServiceTests) groovy.lang.MissingMethodException: No signature of method: RoutingLane.methodMissing() is app

我有两个集成测试。我试图在一个名为RoutingLane的类中使用动态查找器。第二个测试失败,出现MissingMethodException

Failure:  testMockRouteLane2(compliance.processor.services.CalculationServiceTests)
groovy.lang.MissingMethodException: No signature of method: RoutingLane.methodMissing() is applicable for argument types: () values: []
模拟功能包括:

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
}

原因可能是什么?

我想回答我自己的问题,因为我通过阅读另一篇文章发现了这个问题

这是因为我将其从单元测试转换为集成测试,并且没有删除服务类名的
@TestFor
注释


希望这能帮助其他遇到这个问题的人。

域类
RoutingLane
是什么样子的?我在pastebin上放了一个片段,出于隐私原因我更改了一些包的全名。你在使用
buildTestDomain()吗
要在itg测试中填充域obj吗?不,我正在测试环境中的数据源配置中填充内存中的H2数据库。dataSource\u testdatasource{dbCreate=“update”url=“jdbc:h2:mem:btfdw;MVCC=TRUE;LOCK\u TIMEOUT=10000;INIT=runscript from'sample\u bootstrap\u data.sql'”logSql=TRUE}在之前安装一个
如何?