MembersTemplate extends AbstractGithubTemplate implements MembersOperations { @Override public boolean isMemberOfOrganization(String organization, String username) { Map<String, Object> uriVariables = new HashMap<>(); uriVariables.put("organization", organization); uriVariables.put("username", username); HttpStatus status = HttpStatus.NOT_FOUND; try { ResponseEntity<Void> responseEntity = getRestOperations() .getForEntity(buildUri("/orgs/{organization}/members/{username}", uriVariables), Void.class); status = responseEntity.getStatusCode(); } catch (HttpClientErrorException e) { } return HttpStatus.NO_CONTENT.equals(status) ? true : false; } MembersTemplate(RestOperations restOperations, GithubApiUriUtil uriUtil);  MembersTemplate(RestOperations restOperations); @Override List<User> listMembers(String organization); @Override List<User> listPublicMembers(String organization); @Override boolean isMemberOfOrganization(String organization, String username); @Override boolean isPublicMemberOfOrganization(String organization, String username); @Override void removeFromOrganization(String organization, String username);  }
@Test public void isMember() throws Exception { mockServer.expect(requestTo("https: .andExpect(method(HttpMethod.GET)) .andRespond(withNoContent()); boolean answer = membersTemplate.isMemberOfOrganization("zalando-stups", "klaus"); Assertions.assertThat(answer).isTrue(); }
@Test public void isNotMember() throws Exception { mockServer.expect(requestTo("https: .andExpect(method(HttpMethod.GET)) .andRespond(withStatus(NOT_FOUND)); boolean answer = membersTemplate.isMemberOfOrganization("zalando-stups", "klaus"); Assertions.assertThat(answer).isFalse(); }