### Question:
GithubClaimResolver { public ClaimableResultDto claimableResult(final String owner, final String repo, final String number, final RequestStatus requestStatus) { final GithubIssue githubIssue = githubScraper.fetchGithubIssue(owner, repo, number); if (isIssueClosed(githubIssue) && githubIssue.getSolver() != null && (requestStatus == FUNDED || requestStatus == CLAIMABLE)) { return ClaimableResultDto.builder() .claimable(true) .platform(Platform.GITHUB) .claimableByPlatformUserName(githubIssue.getSolver()) .build(); } return ClaimableResultDto.builder().claimable(false).platform(Platform.GITHUB).build(); } GithubClaimResolver(final GithubScraper githubScraper,
                               final AzraelClient azraelClient,
                               final KeycloakRepository keycloakRepository); SignedClaim getSignedClaim(final Principal user, final UserClaimRequest userClaimRequest, final RequestDto request); Boolean canClaim(final Principal user, final RequestDto request); ClaimableResultDto claimableResult(final String owner, final String repo, final String number, final RequestStatus requestStatus); Optional<String> getUserPlatformUsername(final Principal user, final Platform platform);  }### Answer:
@Test public void claimableResult_currentStatusClaimable() { final String owner = "FundRequest"; final String repo = "area51"; final String number = "983"; final String solver = "davyvanroy"; when(githubScraper.fetchGithubIssue(owner, repo, number)).thenReturn(GithubIssue.builder() .solver(solver) .status("Closed") .build()); final ClaimableResultDto result = claimResolver.claimableResult(owner, repo, number, RequestStatus.CLAIMABLE); assertThat(result.isClaimable()).isTrue(); assertThat(result.getPlatform()).isEqualTo(Platform.GITHUB); assertThat(result.getClaimableByPlatformUserName()).isEqualTo(solver); }
@Test public void claimableResult_currentStatusFunded() { final String owner = "FundRequest"; final String repo = "area51"; final String number = "983"; final String solver = "davyvanroy"; when(githubScraper.fetchGithubIssue(owner, repo, number)).thenReturn(GithubIssue.builder() .solver(solver) .status("Closed") .build()); final ClaimableResultDto result = claimResolver.claimableResult(owner, repo, number, RequestStatus.FUNDED); assertThat(result.isClaimable()).isTrue(); assertThat(result.getPlatform()).isEqualTo(Platform.GITHUB); assertThat(result.getClaimableByPlatformUserName()).isEqualTo(solver); }
@Test public void claimableResult_githubIssueNotClosed() { final String owner = "FundRequest"; final String repo = "area51"; final String number = "983"; final String solver = "davyvanroy"; when(githubScraper.fetchGithubIssue(owner, repo, number)).thenReturn(GithubIssue.builder() .status("Open") .solver(solver) .build()); final ClaimableResultDto result = claimResolver.claimableResult(owner, repo, number, RequestStatus.FUNDED); assertThat(result.isClaimable()).isFalse(); assertThat(result.getPlatform()).isEqualTo(Platform.GITHUB); assertThat(result.getClaimableByPlatformUserName()).isNull(); }
@Test public void claimableResult_githubIssueNoSolver() { final String owner = "FundRequest"; final String repo = "area51"; final String number = "983"; when(githubScraper.fetchGithubIssue(owner, repo, number)).thenReturn(GithubIssue.builder() .status("Closed") .build()); final ClaimableResultDto result = claimResolver.claimableResult(owner, repo, number, RequestStatus.FUNDED); assertThat(result.isClaimable()).isFalse(); assertThat(result.getPlatform()).isEqualTo(Platform.GITHUB); assertThat(result.getClaimableByPlatformUserName()).isNull(); }