ThriftToDynamicProto { public FieldDescriptor getFieldDescriptor(Class<? extends TBase<?, ?>> thriftClass, String fieldName) { checkState(thriftClass); Descriptors.Descriptor descriptor = getBuilder(thriftClass).getDescriptorForType(); return descriptor.findFieldByName(fieldName); } ThriftToDynamicProto(Class<T> thriftClass);  ThriftToDynamicProto(Class<T> thriftClass,
                              boolean supportNestedObjects,
                              boolean ignoreUnsupportedTypes);  ThriftToDynamicProto(Class<T> thriftClass, List<Pair<String, Type>> extraFields);  ThriftToDynamicProto(Class<T> thriftClass,
                              List<Pair<String, Type>> extraFields,
                              boolean supportNestedObjects,
                              boolean ignoreUnsupportedTypes); Message.Builder getBuilder(Class<? extends TBase<?, ?>> thriftClass); @SuppressWarnings("unchecked") Message convert(T thriftObj); @SuppressWarnings("unchecked") Message doConvert(TBase<?, F> thriftObj); FieldDescriptor getFieldDescriptor(Class<? extends TBase<?, ?>> thriftClass,
                                            String fieldName); Descriptors.FileDescriptor getFileDescriptor();  }
@Test public void testBadThriftTypeForGetFieldDescriptor() throws DescriptorValidationException { ThriftToDynamicProto<PhoneNumber> converter = new ThriftToDynamicProto<PhoneNumber>(PhoneNumber.class); exception.expect(IllegalStateException.class); converter.getFieldDescriptor(Person.class, "some_field"); }