### Question:
GithubIssueService { public Optional<GithubIssue> findBy(final String platformId) { return GithubId.fromPlatformId(platformId) .map(githubId -> githubScraper.fetchGithubIssue(githubId.getOwner(), githubId.getRepo(), githubId.getNumber())); } GithubIssueService(final GithubScraper githubScraper); Optional<GithubIssue> findBy(final String platformId);  }### Answer:
@Test void findBy() { final String owner = "sfs"; final String repo = "fafsa"; final String number = "43"; final GithubIssue githubIssue = GithubIssue.builder().build(); when(githubScraper.fetchGithubIssue(owner, repo, number)).thenReturn(githubIssue); final Optional<GithubIssue> result = githubIssueService.findBy(owner + "|FR|" + repo + "|FR|" + number); assertThat(result).isPresent().containsSame(githubIssue); }
@Test void findBy_invalidPlatformId() { final String owner = "sfs"; final String repo = "fafsa"; final Optional<GithubIssue> result = githubIssueService.findBy(owner + "|FR|" + repo + "|FR|"); assertThat(result).isEmpty(); }
@Test void findBy_noIssueFound() { final String owner = "sfs"; final String repo = "fafsa"; final String number = "43"; when(githubScraper.fetchGithubIssue(owner, repo, number)).thenReturn(null); final Optional<GithubIssue> result = githubIssueService.findBy(owner + "|FR|" + repo + "|FR|" + number); assertThat(result).isEmpty(); }