}
public void testResourcePost() throws IOException {
server.setMockResponseCode(200);
RestClient client = getRestClient();
Resource resource = client.resource(serviceURL + "/testResourcePost");
String response =
resource.contentType("text/plain").accept("text/plain")
.post(String.class, SENT_MESSAGE);
assertEquals(RECEIVED_MESSAGE, response);
assertEquals(SENT_MESSAGE, server.getRequestContentAsString());
// do post with response
ClientResponse clientResponse = resource.post(SENT_MESSAGE);
assertEquals(RECEIVED_MESSAGE, clientResponse.getEntity(String.class));
// test generic entity
TestGenerics<String> tg = resource.post(new EntityType<TestGenerics<String>>() {
}, SENT_MESSAGE);
assertEquals(RECEIVED_MESSAGE, tg.getT());
assertEquals(200, clientResponse.getStatusType().getStatusCode());
assertEquals(Family.SUCCESSFUL, clientResponse.getStatusType().getFamily());