RepoTemplate extends AbstractGitHubOperations implements RepoOperations { public List<GitHubHook> getHooks(String user, String repo) { return asList(restTemplate.getForObject(buildRepoUri("/hooks"), GitHubHook[].class, user, repo)); } RepoTemplate(RestTemplate restTemplate, boolean isAuthorizedForUser); GitHubRepo getRepo(String user, String repo); List<GitHubUser> getCollaborators(String user, String repo); List<GitHubCommit> getCommits(String user, String repo); List<GitHubDownload> getDownloads(String user, String repo); GitHubDownload getDownload(String user, String repo, Long id); List<GitHubRepo> getForks(String user, String repo); List<GitHubIssue> getIssues(String user, String repo); List<GitHubUser> getWatchers(String user, String repo); List<GitHubHook> getHooks(String user, String repo);  }
@Test public void getHooks() { responseHeaders.setContentType(MediaType.APPLICATION_JSON); mockServer.expect(requestTo("https: .andExpect(method(GET)) .andRespond(withSuccess(jsonResource("repo-hooks"), MediaType.APPLICATION_JSON)); List<GitHubHook> hooks = gitHub.repoOperations().getHooks("octocat", "Hello-World"); assertEquals(1, hooks.size()); GitHubHook hook = hooks.get(0); assertEquals(1, hook.getId()); assertEquals("https: assertEquals("web", hook.getName()); assertTrue(hook.isActive()); assertEquals(new Date(1315329987000L), hook.getCreatedAt()); assertEquals(new Date(1315341563000L), hook.getUpdatedAt()); }