/** Visibility has been relaxed for tests. */
 String getUserFullName(String login) {
   if (login == null) {
     return null;
   }
   User user = userFinder.findByLogin(login);
   if (user == null) { // most probably user was deleted
     return login;
   }
   return StringUtils.defaultIfBlank(user.getName(), login);
 }
  @Before
  public void init() throws Exception {
    mutableReview = mock(MutableReview.class);
    comment = mock(Comment.class);
    when(mutableReview.createComment()).thenReturn(comment);
    review = mock(Review.class);
    workflowContext = mock(WorkflowContext.class);
    settings = new Settings();
    when(workflowContext.getProjectSettings()).thenReturn(settings);
    assigneeLogin = "******";

    jiraIssueCreator = mock(JiraIssueCreator.class);
    reviewDao = mock(ReviewDao.class);
    userFinder = mock(UserFinder.class);

    remoteIssue =
        new Issue(
            null, null, "FOO-15", null, null, null, null, null, null, null, null, null, null, null,
            null, null, null, null, null, null, null, null, null, null, null, null, null, null,
            null, null, null);

    parameters = new HashMap<String, String>();
    parameters.put(JiraConstants.JIRA_ISSUE_REPORTER_PROPERTY, workflowContext.getUserLogin());
    parameters.put(JiraConstants.JIRA_ISSUE_ASSIGNEE_PROPERTY, assigneeLogin);

    ReviewDto reviewDto = new ReviewDto();
    reviewDto.setAssigneeId(40L);
    when(reviewDao.findById(Mockito.anyLong())).thenReturn(reviewDto);
    User assignee = new User();
    assignee.setLogin(assigneeLogin);
    when(userFinder.findById(Mockito.anyInt())).thenReturn(assignee);

    when(jiraIssueCreator.createIssue(review, settings, parameters)).thenReturn(remoteIssue);

    action = new LinkFunction(jiraIssueCreator, reviewDao, userFinder);
  }