@Override
  public MutableAnalysisMetadataHolder setBranch(Branch branch) {
    checkState(!this.branch.isInitialized(), "Branch has already been set");
    boolean isCommunityEdition = editionProvider.get().filter(t -> t == EditionProvider.Edition.COMMUNITY).isPresent();
    checkState(
      !isCommunityEdition || branch.isMain(),
      "Branches and Pull Requests are not supported in Community Edition");
    this.branch.setProperty(branch);
    return this;
  }
@Test
  public void setBranch_throws_ISE_when_called_twice() {
    AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl(editionProvider);
    underTest.setBranch(new DefaultBranchImpl(DEFAULT_MAIN_BRANCH_NAME));

    assertThatThrownBy(() -> underTest.setBranch(new DefaultBranchImpl("main")))
      .isInstanceOf(IllegalStateException.class)
      .hasMessage("Branch has already been set");
  }