@Override
  public Collection<AnticipatedTransition> getAnticipatedTransitionByComponent(Component component) {
    try (DbSession dbSession = dbClient.openSession(false)) {
      String projectUuid = dbClient.entityDao().selectByComponentUuid(dbSession, component.getUuid()).map(EntityDto::getUuid)
        .orElse(calculateProjectUuidFromComponentKey(dbSession, component));
      List<AnticipatedTransitionDto> anticipatedTransitionDtos = dbClient.anticipatedTransitionDao()
        .selectByProjectUuidAndFilePath(dbSession, projectUuid, component.getName());
      return getAnticipatedTransitions(anticipatedTransitionDtos);
    }
  }
@Test
  public void giveProjectBranchAvailable_projectUuidShouldBeCalculatedFromThere() {
    //given
    String projectKey = "projectKey2";
    String projectUuid = "projectUuid2";
    String mainFile = "file1.js";
    dbClient.projectDao().insert(db.getSession(), getProjectDto(projectUuid, projectKey));

    BranchDto branchDto = getBranchDto(projectUuid, "branch");
    dbClient.branchDao().insert(db.getSession(), branchDto);

    ComponentDto fileDto = getComponentDto(projectKey + ":" + mainFile, branchDto.getUuid());
    dbClient.componentDao().insertWithAudit(db.getSession(), fileDto);

    insertAnticipatedTransition(projectUuid, mainFile);
    insertAnticipatedTransition(projectUuid, "file2.js");
    insertAnticipatedTransition(projectUuid, "file2.js");

    db.getSession().commit();

    Component file = getFileComponent(fileDto.uuid(), projectKey, mainFile);
    var anticipatedTransitions = underTest.getAnticipatedTransitionByComponent(file);
    assertThat(anticipatedTransitions).hasSize(1);
  }