use of com.twitter.elephantbird.thrift.test.Person in project elephant-bird by twitter.
the class TestThriftToDynamicProto method genPerson.
private Person genPerson() {
Person person = new Person();
person.setName(new Name("Johnny", "Appleseed"));
person.setId(123);
person.setEmail("email@address.com");
person.setPhones(genPhoneList());
return person;
}
use of com.twitter.elephantbird.thrift.test.Person in project elephant-bird by twitter.
the class TestThriftToDynamicProto method testNestedStructsWhenDisabled.
@Test
public void testNestedStructsWhenDisabled() throws DescriptorValidationException {
ThriftToDynamicProto<Person> thriftToProto = new ThriftToDynamicProto<Person>(Person.class);
Person person = genPerson();
Message msg = thriftToProto.convert(person);
assertEquals(person.id, Protobufs.getFieldByName(msg, "id"));
assertEquals(person.email, Protobufs.getFieldByName(msg, "email"));
// nested structs not converted
assertTrue(!Protobufs.hasFieldByName(msg, "name"));
assertTrue(!Protobufs.hasFieldByName(msg, "phones"));
}
Aggregations