@Test
  public void testOptimizedSerializationDefaultDeserialization() throws Exception {

    TestAllTypes message = createSampleMessage();

    byte[] data = TestAllTypesSerializer.serialize(message);

    protobuf_unittest.UnittestProto.TestAllTypes result =
        protobuf_unittest.UnittestProto.TestAllTypes.parseFrom(data);
    assertNotNull(result);
    assertDeepEquals(result, message);
    assertTrue(result.getUnknownFields().asMap().isEmpty());
  }
  @Test
  public void testOptimizedSerializeToStreamDefaultDeserialization() throws Exception {

    TestAllTypes message = createSampleMessage();

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    TestAllTypesSerializer.serialize(message, baos);

    protobuf_unittest.UnittestProto.TestAllTypes result =
        protobuf_unittest.UnittestProto.TestAllTypes.parseFrom(baos.toByteArray());
    assertNotNull(result);
    assertDeepEquals(result, message);
    assertTrue(result.getUnknownFields().asMap().isEmpty());
  }