public void ParseExtensions() { // TestAllTypes and TestAllExtensions should have compatible wire formats, // so if we serealize a TestAllTypes then parse it as TestAllExtensions // it should work. TestAllTypes message = TestUtil.GetAllSet(); ByteString rawBytes = message.ToByteString(); ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); TestUtil.RegisterAllExtensions(registry); registry = registry.AsReadOnly(); TestAllExtensions message2 = TestAllExtensions.ParseFrom(rawBytes, registry); TestUtil.AssertAllExtensionsSet(message2); }