msg.clearOptionalForeignMessage();
assertFalse(msg.hasOptionalForeignMessage());
msg.clearOptionalForeignMessage()
.setOptionalForeignMessage(new MicroOuterClass.ForeignMessageMicro().setC(2));
assertTrue(msg.hasOptionalForeignMessage());
msg.clear();
assertFalse(msg.hasOptionalForeignMessage());
msg.setOptionalForeignMessage(foreignMsg);
byte [] result = msg.toByteArray();
int msgSerializedSize = msg.getSerializedSize();