GroupsResource extends Resource { public CallSpec<List<XingUser>, HttpError> getLikersOfPost(String postId) { return Resource.<List<XingUser>, HttpError>newGetSpec(api, "/v1/groups/forums/posts/{post_id}") .responseAs(list(XingUser.class, "likes", "users")) .pathParam("post_id", postId) .build(); } GroupsResource(XingApi api); CallSpec<List<Group>, HttpError> getUsersGroups(String userId); CallSpec<List<Group>, HttpError> getOwnGroups(); @Experimental CallSpec<List<Group>, HttpError> findGroupByKeyword(String keywords); CallSpec<List<Forum>, HttpError> getForumsOfGroup(String groupId); CallSpec<List<Post>, HttpError> getPostsOfForum(String forumId); CallSpec<Post, HttpError> getPostInGroup(String postId); CallSpec<List<Post>, HttpError> getAllPostsOfGroup(String groupId); CallSpec<List<XingUser>, HttpError> getLikersOfPost(String postId); CallSpec<Void, HttpError> likePost(String postId); CallSpec<Void, HttpError> unlikePost(String postId); CallSpec<List<Comment>, HttpError> getCommentsOfPost(String postId); CallSpec<Void, HttpError> addCommentToPost(String content, String postId); CallSpec<Void, HttpError> deleteCommentOfPost(String commentId); CallSpec<List<XingUser>, HttpError> getLikersOfComment(String commentId); CallSpec<Void, HttpError> likeComment(String commentId); CallSpec<Void, HttpError> unlikeComment(String commentId); CallSpec<Void, HttpError> markAllPostsAsRead(String groupId); CallSpec<Membership, HttpError> joinGroup(String groupId); CallSpec<Post, HttpError> createPost(String title, String content, String forumId); CallSpec<Void, HttpError> deletePost(String postId); CallSpec<Void, HttpError> leaveGroup(String groupId); CallSpec<MediaPreview, HttpError> createMediaPreview(String url);  }
@Test public void getLikersOfPost() throws Exception { server.enqueue(new MockResponse().setBody(file("groups/likers.json"))); Response<List<XingUser>, HttpError> response = resource.getLikersOfPost("123123").execute(); assertThat(response.body().size()).isEqualTo(6); XingUser firstLiker = response.body().get(0); assertThat(firstLiker).isNotNull(); assertThat(firstLiker.id()).isEqualTo("20455280_f9b463"); }