Search in sources :

Example 11 with EnumValueDescriptor

use of com.google.protobuf.Descriptors.EnumValueDescriptor in project j2objc by google.

the class CompatibilityTest method testGetUnsetField.

public void testGetUnsetField() throws Exception {
    TypicalData data = TypicalData.newBuilder().build();
    Descriptor descriptor = TypicalData.getDescriptor();
    assertEquals(0, data.getField(descriptor.findFieldByNumber(1)));
    Object result = data.getField(descriptor.findFieldByNumber(3));
    assertTrue(result instanceof EnumValueDescriptor);
    assertEquals(TypicalData.EnumType.VALUE1.getValueDescriptor().getNumber(), ((EnumValueDescriptor) result).getNumber());
    assertTrue(data.getField(descriptor.findFieldByNumber(11)) instanceof TypicalDataMessage);
}
Also used : TypicalDataMessage(protos.TypicalDataMessage) TypicalData(protos.TypicalData) Descriptor(com.google.protobuf.Descriptors.Descriptor) FieldDescriptor(com.google.protobuf.Descriptors.FieldDescriptor) EnumDescriptor(com.google.protobuf.Descriptors.EnumDescriptor) EnumValueDescriptor(com.google.protobuf.Descriptors.EnumValueDescriptor) EnumValueDescriptor(com.google.protobuf.Descriptors.EnumValueDescriptor)

Aggregations

EnumValueDescriptor (com.google.protobuf.Descriptors.EnumValueDescriptor)11 ByteString (com.google.protobuf.ByteString)6 FieldDescriptor (com.google.protobuf.Descriptors.FieldDescriptor)6 Descriptor (com.google.protobuf.Descriptors.Descriptor)4 Builder (com.google.protobuf.Message.Builder)3 DataHandler (javax.activation.DataHandler)3 EnumDescriptor (com.google.protobuf.Descriptors.EnumDescriptor)2 DynamicMessage (com.google.protobuf.DynamicMessage)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 List (java.util.List)2 SBase (org.bimserver.shared.meta.SBase)2 JsonToken (com.fasterxml.jackson.core.JsonToken)1 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 Message (com.google.protobuf.Message)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 InputStream (java.io.InputStream)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1