【发布时间】:2017-01-10 23:35:40
【问题描述】:
这让我发疯了。 2.4.4 我的集成测试全部通过。升级到 2.5.5,我到处都收到这样的错误:
No signature of method: Project.addToMonitorings() is applicable for argument types: (Monitoring) values: [Monitoring : (unsaved)] Possible solutions: getMonitorings()
我似乎无法追踪如何更新集成测试以使其再次通过。
示例(当前)测试:
class MonitoringServiceSpec extends Specification {
def monitoringService
TestDataFactory f // factory that builds objects so we can use them in other tests
def setup() {
f = new TestDataFactory()
}
void "results can be limited"() {
given:
Project p = f.getProject()
p.save(flush: true, failOnError: true)
def params = new EcosListParams(new GrailsParameterMap ([offset: 0, max:1, sortColumn: 'id', order: 'asc'], null))
when:
p.addToMonitorings(f.getMonitoring(p)).save(flush: true, failOnError: true)
p.refresh()
def results = monitoringService.getProjectMonitorings(params, p.id)
then:
results.totalCount == 2
results.size() == 1
}
...
}
我在我的应用程序中到处都有一对多关系的地方出现此错误。它们在 2.4.4 中运行良好。
【问题讨论】:
标签: grails integration-testing spock