以下是我的代码......
HashMap<String, String> createSoapClient(JObject jObject, String requestId, String Id){
String url = environmentConfig.getSoapEndPoint();
try {
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection soapConnection = soapConnectionFactory.createConnection();
SOAPMessage soapResponse = soapConnection.call(soapMessage, url);
}...
我想模拟soapConnectionFactory和soapConnection对象但是失败了。我希望这个问题是由SOAPConnectionFactory.newInstance()
单例方法引起的,但我无法改变它。
这是我尝试过的:
given:
environmentConfig.getSoapEndPoint() >> "https://endpointName"
when:
HashMap<String, String> map = service.createSoapClient(obj, "request-id", "abc")
then:
assert map != null