BitbucketHostingService implements VcsHostingService { @Override public String getRepositoryOwnerFromUrl(final String url) { String[] split = url.split("/"); String result = split[split.length - 2]; if (result.contains(":")) { result = result.substring(result.indexOf(":") + 1); } return result; } @Inject  BitbucketHostingService(
      final AppContext appContext,
      final DtoFactory dtoFactory,
      final BitbucketClientService bitbucketClientService,
      final BitBucketTemplates templates,
      final BitBucketServerTemplates bitbucketServerTemplates,
      final SecurityTokenProvider securityTokenProvider,
      @RestContext final String baseUrl); @Override VcsHostingService init(String remoteUrl); @Override String getName(); @Override String getHost(); @Override boolean isHostRemoteUrl(final String remoteUrl); @Override Promise<PullRequest> getPullRequest(
      final String owner, final String repository, final String username, final String branchName); @Override Promise<PullRequest> createPullRequest(
      final String owner,
      final String repository,
      final String username,
      final String headBranchName,
      final String baseBranchName,
      final String title,
      final String body); @Override Promise<Repository> fork(final String owner, final String repository); @Override Promise<Repository> getRepository(String owner, String repositoryName); @Override String getRepositoryNameFromUrl(final String url); @Override String getRepositoryOwnerFromUrl(final String url); @Override Promise<Repository> getUserFork(
      final String user, final String owner, final String repository); @Override Promise<HostUser> getUserInfo(); @Override String makeSSHRemoteUrl(final String username, final String repository); @Override String makeHttpRemoteUrl(final String username, final String repository); @Override String makePullRequestUrl(
      final String username, final String repository, final String pullRequestNumber); @Override String formatReviewFactoryUrl(final String reviewFactoryUrl); @Override Promise<HostUser> authenticate(final CurrentUser user); @Override Promise<PullRequest> updatePullRequest(
      String owner, String repository, PullRequest pullRequest); @Override String toString(); static final String SERVICE_NAME; static final String DEFAULT_ENDPOINT; }
@Test(dataProvider = "repoOwners") public void shouldGetRepositoryOwnerFromUrl(String remoteUrl, String owner) { Assert.assertEquals(bitbucketHostingService.getRepositoryOwnerFromUrl(remoteUrl), owner); }