public void testJsonArraySerializingMatching() { prepareStub("text/plain", "response ignored"); final Requestor requestory = getRequestor(); requestory .request(Book.class, Void.class) .path(uri) .contentType("application/json") .post(bookList); assertEquals(bookArraySerializedAsJson, ServerStub.getRequestData(uri).getData()); }
public void testXmlSerializingMatching() { prepareStub("text/plain", "response ignored"); final Requestor requestory = getRequestor(); requestory .request(Book.class, Void.class) .path(uri) .contentType("application/xml") .post(firstBook); assertEquals(firstBookSerializedAsXml, ServerStub.getRequestData(uri).getData()); }
private void prepareStub(String responseContentType, String serializedResponse) { ServerStub.clearStub(); ServerStub.responseFor( uri, ResponseMock.of(serializedResponse, 200, "OK", new ContentTypeHeader(responseContentType))); }