diff options
author | Léo Geoffroy <99647462+leo-geoffroy-sonarsource@users.noreply.github.com> | 2022-12-07 18:54:00 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-12-07 20:02:57 +0000 |
commit | 32d84b0f2f4aad6653a08509d2ddf058334e0d82 (patch) | |
tree | 27b0c55a9a3af6e4d3f8779c684cdd777fe81ce2 /sonar-plugin-api-impl/src/test | |
parent | 6895a5b7e08fc745f92f19f56723b4e15d91e187 (diff) | |
download | sonarqube-32d84b0f2f4aad6653a08509d2ddf058334e0d82.tar.gz sonarqube-32d84b0f2f4aad6653a08509d2ddf058334e0d82.zip |
SONAR-17745 Message of issue location should be trimmed
Diffstat (limited to 'sonar-plugin-api-impl/src/test')
-rw-r--r-- | sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssueLocationTest.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssueLocationTest.java b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssueLocationTest.java index 1c26aaa4400..4f7b5e552fc 100644 --- a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssueLocationTest.java +++ b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssueLocationTest.java @@ -19,6 +19,7 @@ */ package org.sonar.api.batch.sensor.issue.internal; +import java.util.Collections; import java.util.List; import org.apache.commons.lang.StringUtils; import org.junit.Test; @@ -124,4 +125,14 @@ public class DefaultIssueLocationTest { .hasMessageStartingWith("Character \\u0000 is not supported in issue message") .hasMessageEndingWith(", on component: src/Foo.php"); } + + @Test + public void should_trim_on_default_message_method(){ + assertThat(new DefaultIssueLocation().message(" message ").message()).isEqualTo("message"); + } + + @Test + public void should_not_trim_on_messageFormattings_message_method(){ + assertThat(new DefaultIssueLocation().message(" message ", Collections.emptyList()).message()).isEqualTo(" message "); + } } |