From 1ffa2fb92a7912804c068ee54dcd005e37f08ab1 Mon Sep 17 00:00:00 2001 From: Emmanuel Cron Date: Tue, 6 Oct 2015 17:03:48 -0700 Subject: [PATCH] Added rebuilt tests for serialization with numbers --- .../gson/protobuf/functional/ProtosWithAnnotationsTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/proto/src/test/java/com/google/gson/protobuf/functional/ProtosWithAnnotationsTest.java b/proto/src/test/java/com/google/gson/protobuf/functional/ProtosWithAnnotationsTest.java index e6723ac4..2bb6f183 100644 --- a/proto/src/test/java/com/google/gson/protobuf/functional/ProtosWithAnnotationsTest.java +++ b/proto/src/test/java/com/google/gson/protobuf/functional/ProtosWithAnnotationsTest.java @@ -169,12 +169,16 @@ public class ProtosWithAnnotationsTest extends TestCase { + "}"); InnerMessage proto = gsonWithEnumNumbers.fromJson(json, InnerMessage.class); assertThat(proto.getContent()).isEqualTo(Type.UNKNOWN); + String rebuilt = gsonWithEnumNumbers.toJson(proto); + assertThat(rebuilt).isEqualTo("{\"content\":0}"); json = String.format("{ %n" + " \"content\":\"2\"%n" + "}"); proto = gsonWithEnumNumbers.fromJson(json, InnerMessage.class); assertThat(proto.getContent()).isEqualTo(Type.IMAGE); + rebuilt = gsonWithEnumNumbers.toJson(proto); + assertThat(rebuilt).isEqualTo("{\"content\":2}"); } public void testProtoWithAnnotations_serialize() {