ComponentDto createBranchComponent(DbSession dbSession, ComponentKey componentKey, ComponentDto mainComponentDto, BranchDto mainComponentBranchDto) {
    checkState(delegate != null, "Current edition does not support branch feature");

    return delegate.createBranchComponent(dbSession, componentKey, mainComponentDto, mainComponentBranchDto);
  }
@Test
  public void createBranchComponent_delegates_to_delegate() {
    DbSession dbSession = mock(DbSession.class);
    ComponentKey componentKey = mock(ComponentKey.class);
    ComponentDto mainComponentDto = new ComponentDto();
    ComponentDto expected = new ComponentDto();
    BranchDto mainComponentBranchDto = new BranchDto();
    when(branchSupportDelegate.createBranchComponent(dbSession, componentKey, mainComponentDto, mainComponentBranchDto))
      .thenReturn(expected);

    ComponentDto dto = underTestWithBranch.createBranchComponent(dbSession, componentKey, mainComponentDto, mainComponentBranchDto);

    assertThat(dto).isSameAs(expected);
  }