use of com.google.protobuf.ExtensionRegistryLite in project j2objc by google.
the class CompatibilityTest method testMessageLiteInterface.
public void testMessageLiteInterface() throws Exception {
ExtensionRegistryLite registry = ExtensionRegistryLite.newInstance();
TypicalData data = TypicalData.newBuilder().build();
MessageLite messageLite = data;
MessageLite.Builder builderLite = messageLite.newBuilderForType();
messageLite.writeTo(new ByteArrayOutputStream());
messageLite.writeDelimitedTo(new ByteArrayOutputStream());
builderLite.mergeFrom(new ByteArrayInputStream(new byte[0]));
builderLite.mergeFrom(new ByteArrayInputStream(new byte[0]), registry);
builderLite.mergeDelimitedFrom(new ByteArrayInputStream(new byte[0]));
builderLite.mergeDelimitedFrom(new ByteArrayInputStream(new byte[0]), registry);
assertEquals(0, messageLite.getSerializedSize());
}
use of com.google.protobuf.ExtensionRegistryLite in project j2objc by google.
the class CompatibilityTest method testExtensionRegistryGetUnmodifiable.
public void testExtensionRegistryGetUnmodifiable() throws Exception {
ExtensionRegistry registry = ExtensionRegistry.newInstance();
ExtensionRegistry registry2 = registry.getUnmodifiable();
registry.add(Typical.myPrimitiveExtension);
// Extension added to registry should be visible in registry2.
Descriptor descriptor = TypicalData.getDescriptor();
ExtensionRegistry.ExtensionInfo extensionInfo = registry2.findImmutableExtensionByNumber(descriptor, 1001);
assertNotNull(extensionInfo);
ExtensionRegistryLite registryLite = ExtensionRegistryLite.newInstance();
ExtensionRegistryLite registryLite2 = registryLite.getUnmodifiable();
assertNotNull(registryLite2);
}
Aggregations