Github user neykov commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/441#discussion_r88297251 --- Diff: core/src/test/java/org/apache/brooklyn/util/executor/HttpExecutorImplTest.java --- @@ -71,6 +75,36 @@ public void afterMethod() throws Exception { } @Test + public void testHttpResponse() throws Exception { + Multimap<String, String> responseHeaders = ArrayListMultimap.<String, String>create(); + responseHeaders.put(HTTP_RESPONSE_CUSTOM_HEADER_KEY, HTTP_RESPONSE_CUSTOM_HEADER_VALUE); + HttpResponse httpResponse = new HttpResponse.Builder() + .headers(responseHeaders) + .header(HTTP_RESPONSE_HEADER_KEY, HTTP_RESPONSE_HEADER_VALUE) + .build(); + + MockResponse serverResponse = new MockResponse() + .setResponseCode(200) + .setBody(HTTP_BODY); + + for (Map.Entry<String, String> entry : httpResponse.headers().entries()) { + serverResponse.addHeader(entry.getKey(), entry.getValue()); + } + server.enqueue(serverResponse); + HttpExecutor executor = factory.getHttpExecutor(getProps()); + HttpRequest executorRequest = new HttpRequest.Builder() + .method("GET") + .uri(baseUrl.toURI()) + .build(); + HttpResponse executorResponse = executor.execute(executorRequest); + assertTrue(executorResponse.headers().containsKey(HTTP_RESPONSE_CUSTOM_HEADER_KEY)); + assertTrue(Iterables.getOnlyElement(executorResponse.headers().get(HTTP_RESPONSE_HEADER_KEY)).equals(HTTP_RESPONSE_HEADER_VALUE)); + + assertTrue(executorResponse.headers().containsKey(HTTP_RESPONSE_HEADER_KEY)); + assertTrue(Iterables.getOnlyElement(executorResponse.headers().get(HTTP_RESPONSE_CUSTOM_HEADER_KEY)).equals(HTTP_RESPONSE_CUSTOM_HEADER_VALUE)); + } --- End diff -- The essence of the test is line `90`. You can cut it down to verifying that `httpResponse.headers()` contains the expected values. Everything else just gets that value through a number of hoops before you check it at the end.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---