GroupServiceThreeLeggedOAuth10a extends AbstractGroupService implements OauthGroupService { @Override public Group20 getGroup20(GroupProviderUserOauth oauth, GroupProvider groupProvider, String groupId) { final ThreeLeggedOauth10aGroupProviderApi api = new ThreeLeggedOauth10aGroupProviderApi(groupProvider); final GroupProviderServiceThreeLeggedOAuth10a tls = new GroupProviderServiceThreeLeggedOAuth10a(groupProvider, api); final OAuthService oAuthService = tls.getOAuthService(); Token accessToken = new Token(oauth.getOAuthToken(), oauth.getOAuthSecret()); final String strippedPersonID = convertToExternalPersonId(oauth.getPersonId(), groupProvider); final String strippedGroupID = convertToExternalGroupId(groupId, groupProvider); final OAuthRequest oAuthRequest = getGroupOAuthRequest(groupProvider, api, strippedPersonID, strippedGroupID); oAuthService.signRequest(accessToken, oAuthRequest); log.info("About to get group information with group provider {} for group {} using URL: {}", groupProvider.getIdentifier(), groupId, oAuthRequest); Response oAuthResponse = oAuthRequest.send(); if (oAuthResponse.isSuccessful()) { final Group20Entry group20Entry = getGroup20EntryFromResponse(oAuthResponse.getStream(), groupProvider); log.debug("Got group entry: {}", group20Entry); if (group20Entry == null) { return null; } final List<Group20> group20s = group20Entry.getEntry(); if (group20s != null && group20s.size() == 1) { return group20s.get(0); } else if (group20s != null && group20s.size() > 1) { throw new RuntimeException(String.format("Received %s groups for groupid %s", group20s.size(), groupId)); } } else { log.info("Fetching external group {} for user {} failed with status code {}", groupId, oauth.getPersonId(), oAuthResponse.getCode()); log.trace(oAuthResponse.getBody()); } return null; }  @Override Group20Entry getGroup20Entry(GroupProviderUserOauth oauth, GroupProvider groupProvider, int limit, int offset); @Override List<Group20> getGroup20List(GroupProviderUserOauth oauth, GroupProvider provider); @Override Group20 getGroup20(GroupProviderUserOauth oauth, GroupProvider groupProvider, String groupId); @Override List<Person> getGroupMembers(GroupProviderUserOauth oauth, GroupProvider provider, String groupId); @Override GroupMembersEntry getGroupMembersEntry(GroupProviderUserOauth oauth, GroupProvider provider, String groupId,
      int limit, int offset);  }
@Test public void testGetGroup20Hz() { super.setResponseResource(new ClassPathResource("hz-group.json")); Group20 group20 = groupService.getGroup20(oauth, provider, "HZG-1042"); assertEquals("HZG-1042", group20.getId()); }