admin管理员组文章数量:1392110
I would like test my service return a 400 Bad request when it receive a payload with bad attribute.
I'm using an valid payload and add an invalid attribut. In SOAP-UI, it return a 400 bad request, but not with MockWebServiceClient, the bad attribute is skipped and process the request well.
@WebServiceServerTest({ MyEndpoint.class, WebServiceConfig.class})
class MyEndpointTests {
@Autowired
private MockWebServiceClient client;
@Value("classpath:endpoint/request/myEndoint.myRequest.xml")
private Resource requestFile;
@Test
void myEndpoint_InvalidRequest() throws Exception {
XMLTransformer transformer = new XMLTransformer(requestValidFile);
transformer.add("/", "myRequest",
"/", "thisIsNotAValidAttribute", "false");
this.client
.sendRequest(RequestCreators.withSoapEnvelope(transformer.getSource()))
.andExpect(ResponseMatchers.serverOrReceiverFault());
}
How can i test that ?
本文标签: Testing Spring WShow test BadRequestStack Overflow
版权声明:本文标题:Testing Spring WS - how test BadRequest - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744779754a2624635.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论