diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2018-08-10 17:57:57 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2018-08-21 20:21:04 +0200 |
commit | 736c4964ccfff0c5a94098804f0d53db4c8da4bb (patch) | |
tree | 479c4aff2ed69ac6ff5aa344c88cfecc987ee860 /server/sonar-server-common/src/test/java | |
parent | 35f53579966194ac83fcb0c4b7b570de572ec5cd (diff) | |
download | sonarqube-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.java | 15 |
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(); |