【发布时间】:2014-04-01 12:32:40
【问题描述】:
我想测试一个 grails 应用程序(使用 jaxrs)和它的集成。对于这个任务,我希望使用 jaxrs 插件中很棒的 IntegrationTestCase 类。 这很有挑战性,因为我想在我的应用程序中模拟/替换服务。使用“纯”Spring,我将创建 testcontext 并手动连接模拟。我不知道如何在 grails 中做到这一点。 我尝试直接访问 ApplicationContext
Holders.grailsApplication.mainContext.registerMockBean("myService", new MyMock())
这似乎不起作用,因为在测试期间未使用模拟。有什么想法吗?
【问题讨论】:
标签: spring grails groovy jax-rs integration-testing