簡體   English   中英

春季啟動測試@WebMethod

[英]Spring boot test @WebMethod

我有一個SOAP服務。 像這樣:

@WebMethod
public SomeResourceResponse getSomeThings(
        @XmlElement(required = true)
        @WebParam(name = "id") Long id) {
    SomeResourceResponse resource = new SomeResourceResponse();
    ...
    return resource;
}

如何進行單元測試? 我該如何嘲笑它? 我不明白。 所有現有的Spring教程(例如本教程-https: //spring.io/guides/gs/production-web-service/ )都建議直接使用SOAP UI。

只需調用該方法。

@Test
public void testGetSomeThings() {
   ...
   SomeResourceResponse  result = someResourceResponse.getSomeThings(1);
   ...
   assertEquals(xxx, result);
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM