aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-server-common/src/test/java
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2018-08-10 17:57:57 +0200
committerSonarTech <sonartech@sonarsource.com>2018-08-21 20:21:04 +0200
commit736c4964ccfff0c5a94098804f0d53db4c8da4bb (patch)
tree479c4aff2ed69ac6ff5aa344c88cfecc987ee860 /server/sonar-server-common/src/test/java
parent35f53579966194ac83fcb0c4b7b570de572ec5cd (diff)
downloadsonarqube-736c4964ccfff0c5a94098804f0d53db4c8da4bb.tar.gz
sonarqube-736c4964ccfff0c5a94098804f0d53db4c8da4bb.zip
SONAR-8368 add line remove changelog when closing issue
Diffstat (limited to 'server/sonar-server-common/src/test/java')
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/issue/IssueFieldsSetterTest.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/IssueFieldsSetterTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/IssueFieldsSetterTest.java
index 5d82ac516a9..5143609c3eb 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/IssueFieldsSetterTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/IssueFieldsSetterTest.java
@@ -213,23 +213,28 @@ public class IssueFieldsSetterTest {
@Test
public void unset_line() {
- issue.setLine(new Random().nextInt());
+ int line = new Random().nextInt(500);
+ issue.setLine(line);
- boolean updated = underTest.unsetLine(issue);
+ boolean updated = underTest.unsetLine(issue, context);
assertThat(updated).isTrue();
assertThat(issue.isChanged()).isTrue();
assertThat(issue.line()).isNull();
assertThat(issue.mustSendNotifications()).isFalse();
- // do not save change
- assertThat(issue.currentChange()).isNull();
+ assertThat(issue.currentChange())
+ .extracting(FieldDiffs::diffs)
+ .hasSize(1);
+ FieldDiffs.Diff diff = issue.currentChange().diffs().get("line");
+ assertThat(diff.oldValue()).isEqualTo(line);
+ assertThat(diff.newValue()).isEqualTo("");
}
@Test
public void unset_line_has_no_effect_if_line_is_already_null() {
issue.setLine(null);
- boolean updated = underTest.unsetLine(issue);
+ boolean updated = underTest.unsetLine(issue, context);
assertThat(updated).isFalse();
assertThat(issue.line()).isNull();