@Test
public void testGetUserRepos() throws Exception {

  HttpHeaders headers;
  Cache page1 = mock(Cache.class, "page1"),
      page2 = mock(Cache.class, "page2");
  when(cacheManager.getCache(eq(GitHubApi.class.getName()))).thenReturn(page1);
  when(cacheManager.getCache(eq(GitHubApi.class.getName()))).thenReturn(page2);
  headers = new HttpHeaders();
  headers.set(HttpHeaders.ETAG, "abcd");
  headers.set("Link", "<https://api.github.com/user/1345314/repos?page=2>; rel=\"next\", <https://api.github.com/user/1345314/repos?page=2>; rel=\"last\"");
  server.expect(once(), requestTo("https://api.github.com/users/jcooky/repos")).andExpect(method(HttpMethod.GET))
      .andRespond(withSuccess(new ClassPathResource("github/users-jcooky-repos.1.json"), MediaType.APPLICATION_JSON).headers(headers));
  headers = new HttpHeaders();
  headers.set(HttpHeaders.ETAG, "efgh");
  headers.set("Link", "<https://api.github.com/user/1345314/repos?page=1>; rel=\"first\", <https://api.github.com/user/1345314/repos?page=1>; rel=\"prev\"");
  server.expect(once(), requestTo("https://api.github.com/user/1345314/repos?page=2")).andExpect(method(HttpMethod.GET))
      .andRespond(withSuccess().headers(headers).body(new ClassPathResource("github/users-jcooky-repos.2.json")).contentType(MediaType.APPLICATION_JSON));
  gitHubApi.getUserRepos("jcooky");
  server.verify();
}