aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2014-12-19 11:18:31 +0100
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2014-12-19 11:18:35 +0100
commit4f18574ffcc8ff822afaa40a9a12c690b2fa6fad (patch)
treed23dd6f0f9347aa060be612f8ebb603b3a2d86c4 /sonar-core
parent79e8246a6449e1cac91d5c44262e791dba07e9e7 (diff)
downloadsonarqube-4f18574ffcc8ff822afaa40a9a12c690b2fa6fad.tar.gz
sonarqube-4f18574ffcc8ff822afaa40a9a12c690b2fa6fad.zip
Fix quality flaws
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/test/java/org/sonar/core/issue/db/IssueDtoTest.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDtoTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDtoTest.java
index 829b1f22ba2..bfaff4bda1d 100644
--- a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDtoTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDtoTest.java
@@ -28,6 +28,7 @@ import org.sonar.api.issue.internal.DefaultIssue;
import org.sonar.api.utils.Duration;
import org.sonar.core.rule.RuleDto;
+import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
@@ -128,4 +129,26 @@ public class IssueDtoTest {
assertThat(dto.getLanguage()).isEqualTo("xoo");
}
+ @Test
+ public void set_tags() {
+ IssueDto dto = new IssueDto();
+ assertThat(dto.getTags()).isEmpty();
+ assertThat(dto.getTagsString()).isNull();
+
+ dto.setTags(Arrays.asList("tag1", "tag2", "tag3"));
+ assertThat(dto.getTags()).containsOnly("tag1", "tag2", "tag3");
+ assertThat(dto.getTagsString()).isEqualTo("tag1,tag2,tag3");
+
+ dto.setTags(Arrays.<String>asList());
+ assertThat(dto.getTags()).isEmpty();
+
+ dto.setTagsString("tag1, tag2 ,,tag3");
+ assertThat(dto.getTags()).containsOnly("tag1", "tag2", "tag3");
+
+ dto.setTagsString(null);
+ assertThat(dto.getTags()).isEmpty();
+
+ dto.setTagsString("");
+ assertThat(dto.getTags()).isEmpty();
+ }
}