我正在测试一些使用java库的groovy代码,我想模拟库调用,因为他们使用网络.所以测试中的代码看起来像:
def verifyInformation(String information) {
def request = new OusideLibraryRequest().compose(information)
new OutsideLibraryClient().verify(request)
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用MockFor和StubFor,但我收到的错误如下:
No signature of method: com.myproject.OutsideLibraryTests.MockFor() is applicable for argument types: (java.lang.Class) values: [class com.otherCompany.OusideLibraryRequest]
Run Code Online (Sandbox Code Playgroud)
我正在使用Grails 2.0.3.