@Override
  public ComponentCreationData createProjectAndBindToDevOpsPlatform(DbSession dbSession, CreationMethod creationMethod, Boolean monorepo, @Nullable String projectKey,
    @Nullable String projectName) {

    String pat = findPersonalAccessTokenOrThrow(dbSession, almSettingDto);
    String workspace = ofNullable(almSettingDto.getAppId())
      .orElseThrow(() -> new IllegalArgumentException(String.format("workspace for alm setting %s is missing", almSettingDto.getKey())));

    Repository repo = bitbucketCloudRestClient.getRepo(pat, workspace, devOpsProjectDescriptor.repositoryIdentifier());

    ComponentCreationData componentCreationData = projectCreator.createProject(
      dbSession,
      getProjectKey(workspace, projectKey, repo),
      getProjectName(projectName, repo),
      repo.getMainBranch().getName(),
      creationMethod);
    ProjectDto projectDto = Optional.ofNullable(componentCreationData.projectDto()).orElseThrow();

    createProjectAlmSettingDto(dbSession, repo.getSlug(), projectDto, almSettingDto, monorepo);
    return componentCreationData;
  }
@Test
  void createProjectAndBindToDevOpsPlatform_whenRepositoryNotFound_shouldThrow() {
    mockPatForUser();
    when(almSettingDto.getAppId()).thenReturn("workspace");
    when(bitbucketCloudRestClient.getRepo(USER_PAT, "workspace", REPOSITORY_SLUG)).thenThrow(new IllegalStateException("Problem fetching repository from Bitbucket Cloud"));
    assertThatExceptionOfType(IllegalStateException.class)
      .isThrownBy(() -> underTest.createProjectAndBindToDevOpsPlatform(mock(DbSession.class), CreationMethod.ALM_IMPORT_API, false, null, null))
      .withMessage("Problem fetching repository from Bitbucket Cloud");
  }