return false;
}
- public boolean setProject(DefaultIssue issue, String projectKey, IssueChangeContext context) {
- if (!Objects.equal(projectKey, issue.projectKey())) {
- issue.setProjectKey(projectKey);
- issue.setUpdateDate(context.date());
- issue.setChanged(true);
- return true;
- }
- return false;
- }
-
- public boolean setPastProject(DefaultIssue issue, String previousKey, IssueChangeContext context) {
- String currentProjectKey = issue.projectKey();
- issue.setProjectKey(previousKey);
- return setProject(issue, currentProjectKey, context);
- }
-
public boolean setTags(DefaultIssue issue, Collection<String> tags, IssueChangeContext context) {
Set<String> newTags = Sets.newHashSet(Collections2.transform(
Collections2.filter(tags, new Predicate<String>() {
updater.setNewAuthor(issue, "julien", context);
}
- @Test
- public void set_project() {
- boolean updated = updater.setProject(issue, "sample", context);
- assertThat(updated).isTrue();
- assertThat(issue.projectKey()).isEqualTo("sample");
-
- // do not save change
- assertThat(issue.currentChange()).isNull();
- assertThat(issue.mustSendNotifications()).isFalse();
- }
-
- @Test
- public void set_past_project() {
- issue.setProjectKey("new project key");
- boolean updated = updater.setPastProject(issue, "past project key", context);
- assertThat(updated).isTrue();
- assertThat(issue.projectKey()).isEqualTo("new project key");
-
- // do not save change
- assertThat(issue.currentChange()).isNull();
- assertThat(issue.mustSendNotifications()).isFalse();
- }
-
- @Test
- public void not_set_past_project_if_no_change() {
- issue.setProjectKey("key");
- boolean updated = updater.setPastProject(issue, "key", context);
- assertThat(updated).isFalse();
- assertThat(issue.projectKey()).isEqualTo("key");
- }
-
}