}
@Test
public void clientCanCallServerNegativeMatchXPathBodyOnly() {
// when
mockServerClient.when(new HttpRequest().withBody(new StringBody("/bookstore/book[price>35]/price", Body.Type.XPATH)), exactly(2)).respond(new HttpResponse().withBody("some_body"));
// then
// - in http
assertEquals(
new HttpResponse()
.withStatusCode(HttpStatusCode.NOT_FOUND_404.code()),
makeRequest(
new HttpRequest()
.withURL("https://localhost:" + getMockServerSecurePort() + "/" + servletContext + (servletContext.length() > 0 && !servletContext.endsWith("/") ? "/" : "") + "some_path")
.withMethod("POST")
.withBody(new StringBody("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" + System.getProperty("line.separator") +
"" + System.getProperty("line.separator") +
"<bookstore>" + System.getProperty("line.separator") +
"" + System.getProperty("line.separator") +
"<book category=\"COOKING\">" + System.getProperty("line.separator") +
" <title lang=\"en\">Everyday Italian</title>" + System.getProperty("line.separator") +
" <author>Giada De Laurentiis</author>" + System.getProperty("line.separator") +
" <year>2005</year>" + System.getProperty("line.separator") +
" <price>30.00</price>" + System.getProperty("line.separator") +
"</book>" + System.getProperty("line.separator") +
"" + System.getProperty("line.separator") +
"<book category=\"CHILDREN\">" + System.getProperty("line.separator") +
" <title lang=\"en\">Harry Potter</title>" + System.getProperty("line.separator") +
" <author>J K. Rowling</author>" + System.getProperty("line.separator") +
" <year>2005</year>" + System.getProperty("line.separator") +
" <price>29.99</price>" + System.getProperty("line.separator") +
"</book>" + System.getProperty("line.separator") +
"" + System.getProperty("line.separator") +
"<book category=\"WEB\">" + System.getProperty("line.separator") +
" <title lang=\"en\">Learning XML</title>" + System.getProperty("line.separator") +
" <author>Erik T. Ray</author>" + System.getProperty("line.separator") +
" <year>2003</year>" + System.getProperty("line.separator") +
" <price>31.95</price>" + System.getProperty("line.separator") +
"</book>" + System.getProperty("line.separator") +
"" + System.getProperty("line.separator") +
"</bookstore>", Body.Type.STRING)),
false
)
);
// - in https
assertEquals(
new HttpResponse()
.withStatusCode(HttpStatusCode.NOT_FOUND_404.code()),
makeRequest(
new HttpRequest()
.withURL("https://localhost:" + getMockServerSecurePort() + "/" + servletContext + (servletContext.length() > 0 && !servletContext.endsWith("/") ? "/" : "") + "some_path")
.withMethod("POST")
.withBody(new StringBody("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" + System.getProperty("line.separator") +
"" + System.getProperty("line.separator") +
"<bookstore>" + System.getProperty("line.separator") +
"" + System.getProperty("line.separator") +
"<book category=\"COOKING\">" + System.getProperty("line.separator") +
" <title lang=\"en\">Everyday Italian</title>" + System.getProperty("line.separator") +