GroupTemplate extends AbstractTemplate implements GroupOperations { public Group getGroupDetails(Integer id) { return restOperations.getForObject(GROUP_DETAILS_URL, Group.class, id); } GroupTemplate(RestOperations restOperations); Group getGroupDetails(Integer id); GroupMemberships getGroupMemberships(); GroupMemberships getGroupMemberships(int start, int count); GroupSuggestions getGroupSuggestions(); GroupSuggestions getGroupSuggestions(int start, int count); GroupPosts getPosts(Integer groupId); GroupPosts getPosts(Integer groupId, int start, int count); PostComments getPostComments(String postId); PostComments getPostComments(String postId, int start, int count); void joinGroup(Integer groupId); void leaveGroup(Integer groupId); URI createPost(Integer groupId, String title, String summary); void likePost(String postId); void unlikePost(String postId); void followPost(String postId); void unfollowPost(String postId); void flagPostAsJob(String postId); void flagPostAsPromotion(String postId); void deleteOrFlagPostAsInappropriate(String postId); void addCommentToPost(String postId, String text); void deleteOrFlagCommentAsInappropriate(String commentId); void deleteGroupSuggestion(Integer groupId); static final String BASE_URL; static final String BASE_PEOPLE_URL; static final String GROUP_BASE_URL; static final String GROUP_POSTS_BASE_URL; static final String GROUP_DETAILS_URL; static final String GROUP_JOIN_LEAVE_URL; static final String GROUP_MEMBERSHIPS_URL; static final String GROUP_SUGGESTIONS_URL; static final String GROUP_SUGGESTION_DELETE_URL; static final String GROUP_POSTS_URL; static final String GROUP_POST_COMMENTS_URL; static final String GROUP_CREATE_POST_URL; static final String GROUP_POST_LIKE_URL; static final String GROUP_POST_FOLLOW_URL; static final String GROUP_POST_FLAG_URL; static final String GROUP_POST_DELETE_URL; static final String GROUP_POST_ADD_COMMENT_URL; static final String GROUP_POST_DELETE_COMMENT_URL; }
@Test public void getGroupDetails() { mockServer.expect(requestTo((GroupTemplate.GROUP_DETAILS_URL + "?oauth2_access_token=ACCESS_TOKEN").replaceFirst("\\{group-id\\}", "46964"))).andExpect(method(GET)) .andRespond(withSuccess(new ClassPathResource("group.json", getClass()), MediaType.APPLICATION_JSON)); Group group = linkedIn.groupOperations().getGroupDetails(46964); assertEquals(true, group.getAllowMemberInvites()); assertEquals(GroupCategory.PROFESSIONAL, group.getCategory()); assertEquals(2, group.getCountsByCategory().size()); assertEquals(PostCategory.DISCUSSION, group.getCountsByCategory().get(0).getCategory()); assertEquals(new Integer(11), group.getCountsByCategory().get(0).getCount()); assertEquals(PostCategory.JOB, group.getCountsByCategory().get(1).getCategory()); assertEquals(new Integer(2), group.getCountsByCategory().get(1).getCount()); assertEquals("This is a group for users of the Spring Framework and related projects (Roo, Batch, Integration, BlazeDS, Security, Web Flow etc) to meet and discuss things of common interest.", group.getDescription()); assertEquals(new Integer(46964), group.getId()); assertEquals(true, group.isOpenToNonMembers()); assertEquals("https: assertEquals("en_US", group.getLocale()); assertEquals("Spring Users", group.getName()); assertEquals(10, group.getPosts().getPosts().size()); assertEquals(0, group.getPosts().getStart()); assertEquals(10, group.getPosts().getCount()); assertEquals(199, group.getPosts().getTotal()); assertProfile(group.getPosts().getPosts().get(0).getCreator(), "0_Fb-UVig_", "Business Development Executive at HOSTINGINDIA.CO", "Mukesh", "K.", null, null); assertEquals("g-46964-S-88566811", group.getPosts().getPosts().get(0).getId()); assertEquals("Tips on Choosing The Best Web Hosting Services", group.getPosts().getPosts().get(0).getTitle()); assertEquals(PostType.STANDARD, group.getPosts().getPosts().get(0).getType()); assertEquals(3, group.getRelationToViewer().getAvailableActions().size()); assertEquals(GroupAvailableAction.ADD_POST, group.getRelationToViewer().getAvailableActions().get(0)); assertEquals(GroupAvailableAction.LEAVE, group.getRelationToViewer().getAvailableActions().get(1)); assertEquals(GroupAvailableAction.VIEW_POSTS, group.getRelationToViewer().getAvailableActions().get(2)); assertEquals(MembershipState.MEMBER, group.getRelationToViewer().getMembershipState()); assertEquals("This is a group that welcomes all users of the Spring platform, including Spring Framework, Roo, Batch, Integration, BlazeDS, Security, Web Flow etc.", group.getShortDescription()); assertEquals("https: assertEquals("https: assertEquals("https: }