void () { String issueJson = """ { "id": 1, "iid": 2, "project_id": 3, "title": "Sample title", "state": "opened", "updated_at": "2013-11-14T12:30:39Z", "created_at": "2013-11-14T12:30:39Z" }"""; String projectJson = """ { "id": 3, "name": "project-1" }"""; GitlabIssue issue = GSON.fromJson(issueJson, GitlabIssue.class); GitlabProject project = GSON.fromJson(projectJson, GitlabProject.class); myRepository.setProjects(Collections.singletonList(project)); myRepository.setShouldFormatCommitMessage(true); myRepository.setCommitMessageFormat("{project} {number} {id} {summary}"); LocalTaskImpl localTask = new LocalTaskImpl(new GitlabTask(myRepository, issue)); String changeListComment = TaskUtil.getChangeListComment(localTask); assertEquals("project-1 2 #2 Sample title", changeListComment); myRepository.setProjects(Collections.emptyList()); localTask = new LocalTaskImpl(new GitlabTask(myRepository, issue)); changeListComment = TaskUtil.getChangeListComment(localTask); // Project is unknown, so "" is substituted instead assertEquals(" 2 #2 Sample title", changeListComment); }