Search in sources :

Example 1 with JsonObjectResponseHandler

use of com.adobe.acs.commons.http.JsonObjectResponseHandler in project acs-aem-commons by Adobe-Consulting-Services.

the class HttpClientFactoryImplTest method testJsonGet.

@Test
public void testJsonGet() throws Exception {
    impl.activate(config);
    Request get = impl.get("/anonJson");
    Executor exec = impl.getExecutor();
    JSONObject jsonObject = exec.execute(get).handleResponse(new JsonObjectResponseHandler());
    assertThat(jsonObject.has("foo"), is(true));
    assertThat(jsonObject.getString("foo"), is("bar"));
}
Also used : Executor(org.apache.http.client.fluent.Executor) JSONObject(org.apache.sling.commons.json.JSONObject) HttpRequest(org.mockserver.model.HttpRequest) Request(org.apache.http.client.fluent.Request) JsonObjectResponseHandler(com.adobe.acs.commons.http.JsonObjectResponseHandler) Test(org.junit.Test)

Aggregations

JsonObjectResponseHandler (com.adobe.acs.commons.http.JsonObjectResponseHandler)1 Executor (org.apache.http.client.fluent.Executor)1 Request (org.apache.http.client.fluent.Request)1 JSONObject (org.apache.sling.commons.json.JSONObject)1 Test (org.junit.Test)1 HttpRequest (org.mockserver.model.HttpRequest)1