ContactsResource extends Resource { public CallSpec<ContactPaths, HttpError> getContactPaths(String userId, String otherUserId) { return Resource.<ContactPaths, HttpError>newGetSpec(api, "/v1/users/{user_id}/network/{other_user_id}/paths") .pathParam("user_id", userId) .pathParam("other_user_id", otherUserId) .responseAs(single(ContactPaths.class, "contact_paths")) .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 getContactPaths() throws Exception { server.enqueue(new MockResponse().setBody("{\n" + " \"contact_paths\": {\n" + " \"paths\": [\n" + " {\n" + " \"users\": [\n" + " {\n" + " \"permalink\": \"https: + " \"id\": \"3228492_861e68\",\n" + " \"gender\": \"m\",\n" + " \"display_name\": \"John Doe\"\n" + " },\n" + " {\n" + " \"permalink\": \"https: + " \"id\": \"1160_5fb1b2\",\n" + " \"gender\": \"m\",\n" + " \"display_name\": \"Alex Kämper\"\n" + " },\n" + " {\n" + " \"permalink\": \"https: + " \"id\": \"3647111_82d2c2\",\n" + " \"gender\": \"m\",\n" + " \"display_name\": \"Mark Fugazi\"\n" + " },\n" + " {\n" + " \"permalink\": \"https: + " \"id\": \"3644173_68b1ee\",\n" + " \"gender\": \"m\",\n" + " \"display_name\": \"Max Mustermann\"\n" + " }\n" + " ]\n" + " }\n" + " ],\n" + " \"distance\": 3,\n" + " \"total\": 1\n" + " }\n" + '}')); Response<ContactPaths, HttpError> response = resource.getContactPaths("firstId", "secondId").execute(); ContactPaths paths = response.body(); assertThat(paths.getPaths().size()).isEqualTo(1); assertThat(paths.getPaths().get(0).size()).isEqualTo(4); assertThat(paths.getDistance()).isEqualTo(3); assertThat(paths.getTotal()).isEqualTo(1); }