diff options
author | Adam Cozzette <acozzette@google.com> | 2018-03-13 16:37:29 -0700 |
---|---|---|
committer | Adam Cozzette <acozzette@google.com> | 2018-03-13 16:37:29 -0700 |
commit | 0400cca3236de1ca303af38bf81eab332d042b7c (patch) | |
tree | a8a9b19853f64567c96750a1c7d253926471daa5 /java/core/src/test/java/com/google/protobuf/WireFormatTest.java | |
parent | 96b535cc2f4f7b7e22a1b8622149f7c26a5a3f63 (diff) | |
download | protobuf-0400cca3236de1ca303af38bf81eab332d042b7c.tar.gz protobuf-0400cca3236de1ca303af38bf81eab332d042b7c.tar.bz2 protobuf-0400cca3236de1ca303af38bf81eab332d042b7c.zip |
Integrated internal changes from Google
Diffstat (limited to 'java/core/src/test/java/com/google/protobuf/WireFormatTest.java')
-rw-r--r-- | java/core/src/test/java/com/google/protobuf/WireFormatTest.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/java/core/src/test/java/com/google/protobuf/WireFormatTest.java b/java/core/src/test/java/com/google/protobuf/WireFormatTest.java index 625d4b42..03c33ecf 100644 --- a/java/core/src/test/java/com/google/protobuf/WireFormatTest.java +++ b/java/core/src/test/java/com/google/protobuf/WireFormatTest.java @@ -36,6 +36,7 @@ import protobuf_unittest.UnittestMset.TestMessageSetExtension2; import protobuf_unittest.UnittestProto; import protobuf_unittest.UnittestProto.TestAllExtensions; import protobuf_unittest.UnittestProto.TestAllTypes; +import protobuf_unittest.UnittestProto.TestExtensionInsideTable; import protobuf_unittest.UnittestProto.TestFieldOrderings; import protobuf_unittest.UnittestProto.TestOneof2; import protobuf_unittest.UnittestProto.TestOneofBackwardsCompatible; @@ -235,6 +236,26 @@ public class WireFormatTest extends TestCase { getTestFieldOrderingsRegistry()); assertEquals(source, dest); } + + private static ExtensionRegistry getTestExtensionInsideTableRegistry() { + ExtensionRegistry result = ExtensionRegistry.newInstance(); + result.add(UnittestProto.testExtensionInsideTableExtension); + return result; + } + + public void testExtensionInsideTable() throws Exception { + // Make sure the extension within the range of table is parsed correctly in experimental + // runtime. + TestExtensionInsideTable source = + TestExtensionInsideTable.newBuilder() + .setField1(1) + .setExtension(UnittestProto.testExtensionInsideTableExtension, 23) + .build(); + TestExtensionInsideTable dest = + TestExtensionInsideTable.parseFrom(source.toByteString(), + getTestExtensionInsideTableRegistry()); + assertEquals(source, dest); + } public void testParseMultipleExtensionRangesDynamic() throws Exception { // Same as above except with DynamicMessage. |