@Test
public void testSerializationLength()
{

  final Map<String, Type> fieldToType = Maps.newHashMap();
  final String tboolean = "tboolean";
  final Boolean tbooleanv = true;
  final String tchar = "tchar";
  final Character tcharv = 'A';
  final String tstring = "tstring";
  final String tstringv = "hello";
  final String tfloat = "tfloat";
  final Float tfloatv = 1.0f;
  final String tdouble = "tdouble";
  final Double tdoublev = 2.0;
  final String tbyte = "tbyte";
  final Byte tbytev = 50;
  final String tshort = "tshort";
  final Short tshortv = 1000;
  final String tinteger = "tinteger";
  final Integer tintegerv = 100000;
  final String tlong = "tlong";
  final Long tlongv = 10000000000L;
  int totalBytes = 1 //boolean
      + 2 //char
      + 4 + tstringv.getBytes().length //string
      + 4 //float
      + 8 //double
      + 1 //byte
      + 2 //short
      + 4 //int
      + 8; //long
  fieldToType.put(tboolean, Type.BOOLEAN);
  fieldToType.put(tchar, Type.CHAR);
  fieldToType.put(tstring, Type.STRING);
  fieldToType.put(tfloat, Type.FLOAT);
  fieldToType.put(tdouble, Type.DOUBLE);
  fieldToType.put(tbyte, Type.BYTE);
  fieldToType.put(tshort, Type.SHORT);
  fieldToType.put(tinteger, Type.INTEGER);
  fieldToType.put(tlong, Type.LONG);
  FieldsDescriptor fd = new FieldsDescriptor(fieldToType);
  GPOMutable gpo = new GPOMutable(fd);
  gpo.setFieldGeneric(tboolean, tbooleanv);
  gpo.setFieldGeneric(tchar, tcharv);
  gpo.setField(tstring, tstringv);
  gpo.setFieldGeneric(tfloat, tfloatv);
  gpo.setFieldGeneric(tdouble, tdoublev);
  gpo.setFieldGeneric(tbyte, tbytev);
  gpo.setFieldGeneric(tshort, tshortv);
  gpo.setFieldGeneric(tinteger, tintegerv);
  gpo.setFieldGeneric(tlong, tlongv);
  int serializeLength = GPOUtils.serializedLength(gpo);
  Assert.assertEquals("The serialized byte length is incorrect.", totalBytes, serializeLength);
}