public void testParseExtensions() throws Exception { // 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.newInstance(); TestUtil.registerAllExtensions(registry); registry = registry.getUnmodifiable(); TestAllExtensions message2 = TestAllExtensions.parseFrom(rawBytes, registry); TestUtil.assertAllExtensionsSet(message2); }