ForeignMessage.Builder subBuilder =
builder.getOptionalForeignMessageBuilder();
assertSame(subBuilder, builder.getOptionalForeignMessageOrBuilder());
// repeated fields
ForeignMessage m0 = ForeignMessage.newBuilder().buildPartial();
ForeignMessage m1 = ForeignMessage.newBuilder().buildPartial();
ForeignMessage m2 = ForeignMessage.newBuilder().buildPartial();
builder.addRepeatedForeignMessage(m0);
builder.addRepeatedForeignMessage(m1);
builder.addRepeatedForeignMessage(m2);
assertSame(m0, builder.getRepeatedForeignMessageOrBuilder(0));
assertSame(m1, builder.getRepeatedForeignMessageOrBuilder(1));