From 271d642877c769f52f7aa5fe792ee541e19cd68a Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Wed, 24 Feb 2016 17:17:25 +0100 Subject: [PATCH] Remove dead code in IssueUpdater --- .../org/sonar/server/issue/IssueUpdater.java | 16 ---------- .../sonar/server/issue/IssueUpdaterTest.java | 31 ------------------- 2 files changed, 47 deletions(-) diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueUpdater.java b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueUpdater.java index 303a430134c..3f7d93d12ca 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueUpdater.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueUpdater.java @@ -307,22 +307,6 @@ public class IssueUpdater { 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 tags, IssueChangeContext context) { Set newTags = Sets.newHashSet(Collections2.transform( Collections2.filter(tags, new Predicate() { diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueUpdaterTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueUpdaterTest.java index b536a6d1c7c..7e8544ce2ef 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueUpdaterTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueUpdaterTest.java @@ -544,35 +544,4 @@ public class IssueUpdaterTest { 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"); - } - } -- 2.39.5