TestAllTypesMicro newMsg = TestAllTypesMicro.parseFrom(result);
assertTrue(newMsg.hasOptionalFixed64());
assertEquals(123, newMsg.getOptionalFixed64());
}
public void testMicroOptionalSfixed32() throws Exception {
TestAllTypesMicro msg = new TestAllTypesMicro();
assertFalse(msg.hasOptionalSfixed32());
msg.setOptionalSfixed32(123);
assertTrue(msg.hasOptionalSfixed32());
assertEquals(123, msg.getOptionalSfixed32());
msg.clearOptionalSfixed32();
assertFalse(msg.hasOptionalSfixed32());
msg.clearOptionalSfixed32()
.setOptionalSfixed32(456);
assertTrue(msg.hasOptionalSfixed32());
msg.clear();
assertFalse(msg.hasOptionalSfixed32());
msg.setOptionalSfixed32(123);
byte [] result = msg.toByteArray();
int msgSerializedSize = msg.getSerializedSize();
//System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
assertTrue(msgSerializedSize == 5);
assertEquals(result.length, msgSerializedSize);
TestAllTypesMicro newMsg = TestAllTypesMicro.parseFrom(result);
assertTrue(newMsg.hasOptionalSfixed32());
assertEquals(123, newMsg.getOptionalSfixed32());
}