ContactsResource extends Resource { public CallSpec<List<PendingContactRequest>, HttpError> getPendingContactRequests() { return Resource.<List<PendingContactRequest>, HttpError>newGetSpec(api, " /v1/users/me/contact_requests/sent") .responseAs(list(PendingContactRequest.class, "contact_requests")) .build(); } ContactsResource(XingApi api); CallSpec<List<XingUser>, HttpError> getUserContacts(String userId); CallSpec<List<XingUser>, HttpError> getOwnContacts(); CallSpec<List<String>, HttpError> getOwnContactsIds(); CallSpec<List<String>, HttpError> getAssignedTags(String userId, String contactId); CallSpec<List<String>, HttpError> getOwnAssignedTags(String contactId); CallSpec<List<XingUser>, HttpError> getSharedContacts(String userId); @Experimental CallSpec<List<XingUser>, HttpError> getUpcomingBirthdays(); CallSpec<List<ContactRequest>, HttpError> getIncomingContactRequests(); CallSpec<List<PendingContactRequest>, HttpError> getPendingContactRequests(); CallSpec<Void, HttpError> sendContactRequest(String userId); CallSpec<Void, HttpError> acceptContactRequest(String recipientId, String senderId); CallSpec<Void, HttpError> revokeContactRequest(String recipientId, String senderId); CallSpec<ContactPaths, HttpError> getContactPaths(String userId, String otherUserId); CallSpec<InvitationStats, HttpError> inviteByMail(String... emails);  }
@Test public void getPendingContactRequests() throws Exception { server.enqueue(new MockResponse().setBody("{\n" + " \"contact_requests\": [\n" + " {\n" + " \"sender_id\": \"19828488_2f3282\",\n" + " \"recipient_id\": \"8957208_181cf4\"\n" + " },\n" + " {\n" + " \"sender_id\": \"19828488_2f3282\",\n" + " \"recipient_id\": \"20195666_868fe8\"\n" + " },\n" + " {\n" + " \"sender_id\": \"19828488_2f3282\",\n" + " \"recipient_id\": \"12022726_a0415b\"\n" + " }\n" + " ]\n" + '}')); Response<List<PendingContactRequest>, HttpError> response = resource.getPendingContactRequests().execute(); assertThat(response.body()).containsExactly( new PendingContactRequest("19828488_2f3282", "8957208_181cf4"), new PendingContactRequest("19828488_2f3282", "20195666_868fe8"), new PendingContactRequest("19828488_2f3282", "12022726_a0415b")); }