浏览代码

Remove dead code in IssueUpdater

tags/5.5-M5
Simon Brandhof 8 年前
父节点
当前提交
271d642877

+ 0
- 16
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<String> tags, IssueChangeContext context) {
Set<String> newTags = Sets.newHashSet(Collections2.transform(
Collections2.filter(tags, new Predicate<String>() {

+ 0
- 31
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");
}

}

正在加载...
取消
保存