@Override
  public void triggerForProject(String projectUuid) {
    try (DbSession dbSession = dbClient.openSession(false)) {

      // remove already existing indexing task, if any
      removeExistingIndexationTasksForProject(dbSession, projectUuid);

      dbClient.branchDao().updateAllNeedIssueSyncForProject(dbSession, projectUuid);
      List<BranchDto> branchInNeedOfIssueSync = dbClient.branchDao().selectBranchNeedingIssueSyncForProject(dbSession, projectUuid);
      LOG.info("{} branch(es) found in need of issue sync for project.", branchInNeedOfIssueSync.size());

      List<CeTaskSubmit> tasks = new ArrayList<>();
      for (BranchDto branch : branchInNeedOfIssueSync) {
        tasks.add(buildTaskSubmit(branch));
      }

      ceQueue.massSubmit(tasks);
      dbSession.commit();
    }
  }
@Test
  public void triggerForProject() {
    ProjectDto projectDto = dbTester.components().insertPrivateProject().getProjectDto();
    BranchDto dto = new BranchDto()
      .setBranchType(BRANCH)
      .setKey("branchName")
      .setUuid("branch_uuid")
      .setProjectUuid(projectDto.getUuid())
      .setIsMain(true);
    dbTester.components().insertProjectBranch(projectDto, dto);

    underTest.triggerForProject(projectDto.getUuid());

    Optional<BranchDto> branch = dbClient.branchDao().selectByUuid(dbTester.getSession(), "branch_uuid");
    assertThat(branch).isPresent();
    assertThat(branch.get().isNeedIssueSync()).isTrue();
    verify(ceQueue, times(2)).prepareSubmit();
    verify(ceQueue, times(1)).massSubmit(anyCollection());
    assertThat(logTester.logs(Level.INFO))
      .contains("2 branch(es) found in need of issue sync for project.");
  }