Source:
<code>public void testBoundActionRequestWithClientEntityResponse() throws Exception { final ODataClient odataClient = ODataClientFactory.getClient(); final ODataWriter odataWriter = odataClient.getWriter(); final HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); httpClientBuilder.addInterceptorFirst(new HttpResponseInterceptor() { @Override public void process(HttpResponse response, HttpContext context) throws HttpException, IOException { if (response.getStatusLine().getStatusCode() == 204) { try { response.setEntity( new InputStreamEntity( odataWriter.writeEntity(createEntity(), ContentType.JSON), org.apache.http.entity.ContentType.parse(ContentType.JSON.toContentTypeString()))); <START> response.setStatusCode(200); <END> } catch (ODataSerializerException e) { throw new IOException(e); } } } }); final Olingo4App olingoApp = new Olingo4AppImpl(getRealServiceUrl(TEST_SERVICE_BASE_URL), httpClientBuilder); olingoApp.setContentType(TEST_FORMAT_STRING); final TestOlingo4ResponseHandler<Edm> responseHandler = new TestOlingo4ResponseHandler<>(); olingoApp.read(null, Constants.METADATA, null, null, responseHandler); final Edm edm = responseHandler.await(); final ClientEntity clientEntity = objFactory.newEntity(null); clientEntity.getProperties().add(objFactory.newPrimitiveProperty("userName", objFactory.newPrimitiveValueBuilder().buildString("scottketchum"))); clientEntity.getProperties().add(objFactory.newPrimitiveProperty("tripId", objFactory.newPrimitiveValueBuilder().buildInt32(0))); final TestOlingo4ResponseHandler<ClientEntity> actionResponseHandler = new TestOlingo4ResponseHandler<>(); olingoApp.action(edm, TEST_BOUND_ACTION_PEOPLE_SHARETRIP, null, clientEntity, actionResponseHandler); final ClientEntity result = actionResponseHandler.await(); assertEquals("lewisblack", result.getProperty("UserName").getValue().toString()); }</code><technical_language>nice change values HttpStatusCode... constants for understanding</technical_language>

Target:
public void testBoundActionRequestWithClientEntityResponse() throws Exception { final ODataClient odataClient = ODataClientFactory.getClient(); final ODataWriter odataWriter = odataClient.getWriter(); final HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); httpClientBuilder.addInterceptorFirst(new HttpResponseInterceptor() { @Override public void process(HttpResponse response, HttpContext context) throws HttpException, IOException { if (response.getStatusLine().getStatusCode() == HttpStatusCode.NO_CONTENT.getStatusCode()) { try { response.setEntity( new InputStreamEntity( odataWriter.writeEntity(createEntity(), ContentType.JSON), org.apache.http.entity.ContentType.parse(ContentType.JSON.toContentTypeString()))); response.setStatusCode(HttpStatusCode.OK.getStatusCode()); } catch (ODataSerializerException e) { throw new IOException(e); } } } }); final Olingo4App olingoApp = new Olingo4AppImpl(getRealServiceUrl(TEST_SERVICE_BASE_URL), httpClientBuilder); olingoApp.setContentType(TEST_FORMAT_STRING); final TestOlingo4ResponseHandler<Edm> responseHandler = new TestOlingo4ResponseHandler<>(); olingoApp.read(null, Constants.METADATA, null, null, responseHandler); final Edm edm = responseHandler.await(); final ClientEntity clientEntity = objFactory.newEntity(null); clientEntity.getProperties().add(objFactory.newPrimitiveProperty("userName", objFactory.newPrimitiveValueBuilder().buildString("scottketchum"))); clientEntity.getProperties().add(objFactory.newPrimitiveProperty("tripId", objFactory.newPrimitiveValueBuilder().buildInt32(0))); final TestOlingo4ResponseHandler<ClientEntity> actionResponseHandler = new TestOlingo4ResponseHandler<>(); olingoApp.action(edm, TEST_BOUND_ACTION_PEOPLE_SHARETRIP, null, clientEntity, actionResponseHandler); final ClientEntity result = actionResponseHandler.await(); assertEquals("lewisblack", result.getProperty("UserName").getValue().toString()); }