@Test public void getRecentPolishCommitNoMatch() { expectJsonPages("https: "github/spring-framework-commits-no-polish.json", "github/spring-framework-commits-no-polish.json", "github/spring-framework-commits-no-polish.json", "github/spring-framework-commits-no-polish.json", "github/spring-framework-commits-no-polish.json"); Commit recentPolish = this.githubClient.getRecentPolishCommit("spring-projects", "spring-framework"); assertThat(recentPolish).isNull(); verify(this.counterService, times(5)).increment("cfp.github.requests"); }
@Cacheable("github.polishCommit") public Commit getRecentPolishCommit(String organization, String project) { ResponseEntity<Commit[]> page = doGetRecentCommit(organization, project); for (int i = 0; i < 4; i++) { Commit commit = Stream.of(page.getBody()) .filter(c -> c.getMessage().toLowerCase().contains("polish")) .findFirst() .orElse(null); if (commit != null) { return commit; } String nextPage = parseLinkHeader(page).get("next"); if (nextPage != null) { page = invoke(createRequestEntity(nextPage), Commit[].class); } else { break; } } return null; }
GithubClient { @Cacheable("github.polishCommit") public Commit getRecentPolishCommit(String organization, String project) { ResponseEntity<Commit[]> page = doGetRecentCommit(organization, project); for (int i = 0; i < 4; i++) { Commit commit = Stream.of(page.getBody()) .filter(c -> c.getMessage().toLowerCase().contains("polish")) .findFirst() .orElse(null); if (commit != null) { return commit; } String nextPage = parseLinkHeader(page).get("next"); if (nextPage != null) { page = invoke(createRequestEntity(nextPage), Commit[].class); } else { break; } } return null; } }
GithubClient { @Cacheable("github.polishCommit") public Commit getRecentPolishCommit(String organization, String project) { ResponseEntity<Commit[]> page = doGetRecentCommit(organization, project); for (int i = 0; i < 4; i++) { Commit commit = Stream.of(page.getBody()) .filter(c -> c.getMessage().toLowerCase().contains("polish")) .findFirst() .orElse(null); if (commit != null) { return commit; } String nextPage = parseLinkHeader(page).get("next"); if (nextPage != null) { page = invoke(createRequestEntity(nextPage), Commit[].class); } else { break; } } return null; } GithubClient(CounterService counterService, RestTemplateBuilder restTemplateBuilder,
			CfpProperties properties); }
GithubClient { @Cacheable("github.polishCommit") public Commit getRecentPolishCommit(String organization, String project) { ResponseEntity<Commit[]> page = doGetRecentCommit(organization, project); for (int i = 0; i < 4; i++) { Commit commit = Stream.of(page.getBody()) .filter(c -> c.getMessage().toLowerCase().contains("polish")) .findFirst() .orElse(null); if (commit != null) { return commit; } String nextPage = parseLinkHeader(page).get("next"); if (nextPage != null) { page = invoke(createRequestEntity(nextPage), Commit[].class); } else { break; } } return null; } GithubClient(CounterService counterService, RestTemplateBuilder restTemplateBuilder,
			CfpProperties properties); @Cacheable("github.commits") List<Commit> getRecentCommits(String organization, String project); @Cacheable("github.polishCommit") Commit getRecentPolishCommit(String organization, String project); @Cacheable("github.user") GithubUser getUser(String githubId); }
GithubClient { @Cacheable("github.polishCommit") public Commit getRecentPolishCommit(String organization, String project) { ResponseEntity<Commit[]> page = doGetRecentCommit(organization, project); for (int i = 0; i < 4; i++) { Commit commit = Stream.of(page.getBody()) .filter(c -> c.getMessage().toLowerCase().contains("polish")) .findFirst() .orElse(null); if (commit != null) { return commit; } String nextPage = parseLinkHeader(page).get("next"); if (nextPage != null) { page = invoke(createRequestEntity(nextPage), Commit[].class); } else { break; } } return null; } GithubClient(CounterService counterService, RestTemplateBuilder restTemplateBuilder,
			CfpProperties properties); @Cacheable("github.commits") List<Commit> getRecentCommits(String organization, String project); @Cacheable("github.polishCommit") Commit getRecentPolishCommit(String organization, String project); @Cacheable("github.user") GithubUser getUser(String githubId);  }