private static void testStructField(StructFieldTestCase testCase) throws Exception {
TMemoryBuffer buf = new TMemoryBuffer(0);
TProtocol proto = factory.getProtocol(buf);
TField field = new TField("test_field", testCase.type_, testCase.id_);
proto.writeStructBegin(new TStruct("test_struct"));
proto.writeFieldBegin(field);
testCase.writeMethod(proto);
proto.writeFieldEnd();
proto.writeStructEnd();
// System.out.println(buf.inspect());
proto.readStructBegin();
TField readField = proto.readFieldBegin();
// TODO: verify the field is as expected
if (!field.equals(readField)) {
throw new RuntimeException("Expected " + field + " but got " + readField);
}
testCase.readMethod(proto);