Search in sources :

Example 6 with RestResponse

use of org.motechproject.mds.rest.RestResponse in project motech by motech.

the class MdsRestBundleIT method verifyMultiLookup.

private void verifyMultiLookup(int lookupParam, String... expectedStrings) throws Exception {
    HttpGet get = new HttpGet(ENTITY_URL + "?lookup=byInt&intField=" + lookupParam + "&sort=strField&order=ASC");
    String responseBody = getHttpClient().execute(get, new BasicResponseHandler());
    RestResponse response = OBJECT_MAPPER.readValue(responseBody, RestResponse.class);
    List strings = Lambda.extract(response.getData(), PropertyUtils.getProperty(on(RestProjection.class), "strField"));
    assertEquals(asList(expectedStrings), strings);
}
Also used : RestResponse(org.motechproject.mds.rest.RestResponse) HttpGet(org.apache.http.client.methods.HttpGet) BasicResponseHandler(org.apache.http.impl.client.BasicResponseHandler) Arrays.asList(java.util.Arrays.asList) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

RestResponse (org.motechproject.mds.rest.RestResponse)6 ArrayList (java.util.ArrayList)4 BasicResponseHandler (org.apache.http.impl.client.BasicResponseHandler)4 Arrays.asList (java.util.Arrays.asList)3 List (java.util.List)3 QueryParams (org.motechproject.mds.query.QueryParams)3 Map (java.util.Map)2 HttpGet (org.apache.http.client.methods.HttpGet)2 HttpPost (org.apache.http.client.methods.HttpPost)2 HttpPut (org.apache.http.client.methods.HttpPut)2 StringEntity (org.apache.http.entity.StringEntity)2 Test (org.junit.Test)2 HashSet (java.util.HashSet)1 HttpResponse (org.apache.http.HttpResponse)1 HttpDelete (org.apache.http.client.methods.HttpDelete)1 JavaType (org.codehaus.jackson.type.JavaType)1 RestProjection (org.motechproject.mds.rest.RestProjection)1 MotechDataService (org.motechproject.mds.service.MotechDataService)1 Order (org.motechproject.mds.util.Order)1