@Override
  public void onIssue(Component component, DefaultIssue issue) {
    if (issue.authorLogin() != null) {
      return;
    }
    loadScmChangesets(component);
    Optional<String> scmAuthor = guessScmAuthor(issue, component);

    if (scmAuthor.isPresent()) {
      if (scmAuthor.get().length() <= IssueDto.AUTHOR_MAX_SIZE) {
        issueUpdater.setNewAuthor(issue, scmAuthor.get(), changeContext);
      } else {
        LOGGER.debug("SCM account '{}' is too long to be stored as issue author", scmAuthor.get());
      }
    }

    if (issue.assignee() == null) {
      UserIdDto userId = scmAuthor.map(scmAccountToUser::getNullable).orElse(defaultAssignee.loadDefaultAssigneeUserId());
      issueUpdater.setNewAssignee(issue, userId, changeContext);
    }
  }
@Test
  void assign_but_do_not_set_author_if_too_long() {
    String scmAuthor = range(0, 256).mapToObj(i -> "s").collect(joining());
    addScmUser(scmAuthor, buildUserId("u123", "John C"));
    setSingleChangeset(scmAuthor, 123456789L, "rev-1");
    DefaultIssue issue = newIssueOnLines(1);

    underTest.onIssue(FILE, issue);

    assertThat(issue.authorLogin()).isNull();
    assertThat(issue.assignee()).isEqualTo("u123");
    assertThat(issue.assigneeLogin()).isEqualTo("John C");

    assertThat(logTester.logs(Level.DEBUG)).contains("SCM account '" + scmAuthor + "' is too long to be stored as issue author");
  }