diff options
author | Jisi Liu <jisi.liu@gmail.com> | 2015-02-23 17:24:36 -0800 |
---|---|---|
committer | Jisi Liu <jisi.liu@gmail.com> | 2015-02-23 17:24:36 -0800 |
commit | e70329c6c0a2a9ebbbd1038f076d823e730512a7 (patch) | |
tree | d41aa8bb5d2e643edb6b58d532ac4be5ba4448ee /java/src/test | |
parent | 20042b72da0a4fef46fd90e1e7766d124f16e465 (diff) | |
download | protobuf-e70329c6c0a2a9ebbbd1038f076d823e730512a7.tar.gz protobuf-e70329c6c0a2a9ebbbd1038f076d823e730512a7.tar.bz2 protobuf-e70329c6c0a2a9ebbbd1038f076d823e730512a7.zip |
Propogate onChange() event when getFooBuilder() is on an oneof message
field.
Change-Id: Idb5b53da5accd24038a895aba49b684eeee95814
Diffstat (limited to 'java/src/test')
-rw-r--r-- | java/src/test/java/com/google/protobuf/GeneratedMessageTest.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/java/src/test/java/com/google/protobuf/GeneratedMessageTest.java b/java/src/test/java/com/google/protobuf/GeneratedMessageTest.java index 41ed7bd0..2d101ba7 100644 --- a/java/src/test/java/com/google/protobuf/GeneratedMessageTest.java +++ b/java/src/test/java/com/google/protobuf/GeneratedMessageTest.java @@ -56,9 +56,10 @@ import protobuf_unittest.UnittestProto; import protobuf_unittest.UnittestProto.ForeignEnum; import protobuf_unittest.UnittestProto.ForeignMessage; import protobuf_unittest.UnittestProto.ForeignMessageOrBuilder; +import protobuf_unittest.UnittestProto.NestedTestAllTypes; import protobuf_unittest.UnittestProto.TestAllExtensions; -import protobuf_unittest.UnittestProto.TestAllTypes; import protobuf_unittest.UnittestProto.TestAllTypes.NestedMessage; +import protobuf_unittest.UnittestProto.TestAllTypes; import protobuf_unittest.UnittestProto.TestAllTypesOrBuilder; import protobuf_unittest.UnittestProto.TestExtremeDefaultValues; import protobuf_unittest.UnittestProto.TestOneof2; @@ -1510,6 +1511,17 @@ public class GeneratedMessageTest extends TestCase { } } + public void testOneofNestedBuilderOnChangePropagation() { + NestedTestAllTypes.Builder parentBuilder = NestedTestAllTypes.newBuilder(); + TestAllTypes.Builder builder = parentBuilder.getPayloadBuilder(); + builder.getOneofNestedMessageBuilder(); + assertTrue(builder.hasOneofNestedMessage()); + assertTrue(parentBuilder.hasPayload()); + NestedTestAllTypes message = parentBuilder.build(); + assertTrue(message.hasPayload()); + assertTrue(message.getPayload().hasOneofNestedMessage()); + } + public void testGetRepeatedFieldBuilder() { Descriptor descriptor = TestAllTypes.getDescriptor(); |