GistTemplate extends AbstractGitHubOperations implements GistOperations { public List<GitHubGist> getUserGists(String user) { return asList(restTemplate.getForObject(buildUri("users/{user}/gists"), GitHubGist[].class, user)); } GistTemplate(RestTemplate restTemplate, boolean isAuthorizedForUser); List<GitHubGist> getUserGists(String user); List<GitHubGist> getGists(); List<GitHubGist> getPublicGists(); List<GitHubGist> getStarredGists(); GitHubGist getGist(String id); List<GitHubComment> getGistComments(String id); GitHubComment getGistComment(Long id);  }
@Test public void getUserGists() { responseHeaders.setContentType(MediaType.APPLICATION_JSON); mockServer.expect(requestTo("https: .andExpect(method(GET)) .andRespond(withSuccess(jsonResource("user-gists"), MediaType.APPLICATION_JSON)); List<GitHubGist> gists = gitHub.gistOperations().getUserGists("kdonald"); assertEquals(4, gists.size()); GitHubGist gist = gists.get(0); assertEquals(0, gist.getComments()); assertTrue(gist.isPublic()); assertEquals("https: assertEquals("git@gist.github.com:1603296.git", gist.getGitPushUrl()); assertEquals("git: assertNotNull(gist.getCreatedAt()); assertNotNull(gist.getUpdatedAt()); GitHubFile file = gist.getFiles().get("jmustache-spring-mvc.java"); assertNotNull(file); assertEquals("jmustache-spring-mvc.java", file.getFilename()); assertEquals("text/plain", file.getType()); assertEquals("https: assertEquals("Java", file.getLanguage()); assertEquals(3749L, file.getSize()); assertNull(file.getContent()); }