更新时间:2023-11-16 22:32:04
您可以使用
HttpClient.metaClass.executeMethod = {Type name -> doSomething}
您需要使用正确的Type
(即String、Map 等)声明闭包签名
You need to declare the closure signature with the correct Type
i.e. String, Map, etc.
void testSendMessage(){
def serviceUrl = properties.getProperty("ITEM").toString()
// mocking to return null
HttpClient.metaClass.executeMethod = {HttpMethod str -> null}
def responseXml = helper.message(serviceUrl)
}