### Question:
GithubId { public static Optional<GithubId> fromString(final String githubIdAsString) { final Pattern pattern = Pattern.compile("^.*/(?<owner>.+)/(?<repo>.+)/.+/(?<number>\\d+)$"); final Matcher matcher = pattern.matcher(githubIdAsString); if (matcher.matches()) { return Optional.of(GithubId.builder() .owner(matcher.group("owner")) .repo(matcher.group("repo")) .number(matcher.group("number")) .build()); } return Optional.empty(); }  static Optional<GithubId> fromString(final String githubIdAsString); static Optional<GithubId> fromPlatformId(final String platformId);  }### Answer:
@Test public void fromString_issue() { final String owner = "FundRequest"; final String repo = "area51"; final String number = "38"; final Optional<GithubId> result = GithubId.fromString(String.format("/%s/%s/issues/%s", owner, repo, number)); assertThat(result).isPresent() .contains(GithubId.builder().owner(owner).repo(repo).number(number).build()); }
@Test public void fromString_issueFullURL() { final String owner = "trufflesuite"; final String repo = "truffle"; final String number = "501"; final Optional<GithubId> result = GithubId.fromString(String.format("https: assertThat(result).isPresent() .contains(GithubId.builder().owner(owner).repo(repo).number(number).build()); }
@Test public void fromString_pullrequest() { final String owner = "smartcontractkit"; final String repo = "chainlink"; final String number = "276"; final Optional<GithubId> result = GithubId.fromString(String.format("/%s/%s/pull/%s", owner, repo, number)); assertThat(result).isPresent() .contains(GithubId.builder().owner(owner).repo(repo).number(number).build()); }
@Test public void fromString_pullrequestFullURL() { final String owner = "aragon"; final String repo = "aragonOS"; final String number = "204"; final Optional<GithubId> result = GithubId.fromString(String.format("https: assertThat(result).isPresent() .contains(GithubId.builder().owner(owner).repo(repo).number(number).build()); }
@Test public void fromString_noMatchEmtpy() { final Optional<GithubId> result = GithubId.fromString("/hfgdjfgk"); assertThat(result).isEmpty(); }