MessagesResource extends Resource { public CallSpec<ConversationMessage, HttpError> sendMessageToConversation(String userId, String conversationId, String messageContent) { return Resource.<ConversationMessage, HttpError>newPostSpec(api, "/v1/users/{user_id}/conversations/{conversation_id}/messages", false) .pathParam("user_id", userId) .pathParam("conversation_id", conversationId) .queryParam("content", messageContent) .responseAs(single(ConversationMessage.class, "message")) .build(); } MessagesResource(XingApi api); CallSpec<List<Conversation>, HttpError> getConversationsByUserId(String userId); CallSpec<Conversation, HttpError> createConversation(String userId, String subject, String content,
          String... recipientIds); CallSpec<Void, HttpError> validateRecipient(String userId); CallSpec<Conversation, HttpError> getSingleConversation(String conversationId, String userId); CallSpec<List<MessageAttachment>, HttpError> getAttachmentsOfConversation(String conversationId); CallSpec<String, HttpError> getAttachmentDownloadLink(String conversationId, String attachmentId); CallSpec<Void, HttpError> markConversationAsRead(String conversationId, String userId); CallSpec<Void, HttpError> markConverastionAsUnread(String conversationId, String userId); CallSpec<List<ConversationMessage>, HttpError> getConversationMessages(String conversationId, String userId); CallSpec<ConversationMessage, HttpError> getSingleConversationMessage(String conversationId, String messageId,
          String userId); CallSpec<Void, HttpError> markMessageAsRead(String conversationId, String messageId, String userId); CallSpec<Void, HttpError> markMessageAsUnread(String conversationId, String messageId, String userId); CallSpec<ConversationMessage, HttpError> sendMessageToConversation(String userId, String conversationId,
          String messageContent); CallSpec<Void, HttpError> deleteConversation(String userId, String conversationId);  }
@Test public void sendMessageToConversation() throws Exception { server.enqueue(new MockResponse().setBody(file("messages/conversation_message.json"))); Response<ConversationMessage, HttpError> response = resource.sendMessageToConversation("", "", "").execute(); assertThat(response.body().getContent()).isEqualTo("New message"); }