Code example for StringEntity

0
    public PersitingActorTestCase<T> given(String httpResponseBody) {
        httpResponse = new BasicHttpResponse(new BasicStatusLine(new ProtocolVersion("http", 1, 1),
                200, "OK")); 
        StringEntity entity = null;
        try { 
            entity = new StringEntity(httpResponseBody);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } 
        httpResponse.setEntity(entity);
        return this;
    } 
 
    public PersitingActorTestCase<T> whenReceived() { 
        actor.onResponseReceived(httpResponse);
        return this;
    } 
 
    public void inserts(List<Pair<Uri, ContentValues>> values) {
        assertEquals(values.size(), resolver.operations.size());
Stop searching for code, let great code find you!  Add Codota to your java IDE