diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-07-29 08:34:35 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-07-30 11:43:12 +0200 |
commit | 314af7bed8b61cf179a1896c810967c6f5257a6a (patch) | |
tree | f4b0b52f8c45ec6dabe5df66949623ab53b274fb /sonar-core | |
parent | ab244f2e1eaffb89aad3eb3659429c87249ab501 (diff) | |
download | sonarqube-314af7bed8b61cf179a1896c810967c6f5257a6a.tar.gz sonarqube-314af7bed8b61cf179a1896c810967c6f5257a6a.zip |
New WS api/rules/list for batch
Diffstat (limited to 'sonar-core')
-rw-r--r-- | sonar-core/src/test/java/org/sonar/core/util/ProtobufJsonFormatTest.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sonar-core/src/test/java/org/sonar/core/util/ProtobufJsonFormatTest.java b/sonar-core/src/test/java/org/sonar/core/util/ProtobufJsonFormatTest.java index ee036208c9e..d81033e5fd8 100644 --- a/sonar-core/src/test/java/org/sonar/core/util/ProtobufJsonFormatTest.java +++ b/sonar-core/src/test/java/org/sonar/core/util/ProtobufJsonFormatTest.java @@ -66,4 +66,18 @@ public class ProtobufJsonFormatTest { ProtobufJsonFormat.write(protobuf, JsonWriter.of(new StringWriter())); } + + @Test + public void protobuf_empty_strings_are_not_output() throws Exception { + org.sonar.core.test.Test.Fake protobuf = org.sonar.core.test.Test.Fake.newBuilder().build(); + + // field is not set but value is "", not null + assertThat(protobuf.hasAString()).isFalse(); + assertThat(protobuf.getAString()).isEqualTo(""); + + StringWriter json = new StringWriter(); + JsonWriter jsonWriter = JsonWriter.of(json); + ProtobufJsonFormat.write(protobuf, jsonWriter); + assertThat(json.toString()).isEqualTo("{}"); + } } |