@Test public void xmlShouldBePosted() throws Exception { final String requestBody = "<xml><test>data</test></xml>"; final String responseBody = String.format("<xml><test>%s</test></xml>", OK_RESPONSE); final byte[] request = requestBody.getBytes("UTF-8"); mockServerClient.when(request().withBody(requestBody)) .respond(response().withBody(responseBody).withStatusCode(200)); byte[] response = httpHelper.post(baseUrl, request, A_USERNAME, A_PASSWORD); assertThat(responseBody, equalTo(new String(response, "UTF-8"))); }
public byte[] post(String url, byte[] content, String username, String password) throws IOException { return post(url, content, username, password, ImmutableMap.<String, String>of()); }
HttpHelper { public byte[] post(String url, byte[] content, String username, String password) throws IOException { return post(url, content, username, password, ImmutableMap.<String, String>of()); } }
HttpHelper { public byte[] post(String url, byte[] content, String username, String password) throws IOException { return post(url, content, username, password, ImmutableMap.<String, String>of()); } HttpHelper(); }
HttpHelper { public byte[] post(String url, byte[] content, String username, String password) throws IOException { return post(url, content, username, password, ImmutableMap.<String, String>of()); } HttpHelper(); String retrieveContent(String url); byte[] post(String url, byte[] content, String username, String password); byte[] post(String url, byte[] content, String username, String password,
            Map<String, String> headers); String retrieveContent(String url, String username, String password); List<String> queryXml(String url, String username, String password, String... xpathQueries); void setConnectionTimeout(int connectionTimeout); }
HttpHelper { public byte[] post(String url, byte[] content, String username, String password) throws IOException { return post(url, content, username, password, ImmutableMap.<String, String>of()); } HttpHelper(); String retrieveContent(String url); byte[] post(String url, byte[] content, String username, String password); byte[] post(String url, byte[] content, String username, String password,
            Map<String, String> headers); String retrieveContent(String url, String username, String password); List<String> queryXml(String url, String username, String password, String... xpathQueries); void setConnectionTimeout(int connectionTimeout);  }