@Test
public void recordTypeKeyChanged() {

    RecordMetaData metaData1 = RecordMetaData.build(TestRecords1Proto.getDescriptor());
    RecordMetaDataProto.MetaData.Builder protoBuilder = metaData1.toProto().toBuilder()
            .setVersion(metaData1.getVersion() + 1);
    protoBuilder.getRecordTypesBuilder(0)
            .setExplicitKey(RecordMetaDataProto.Value.newBuilder()
                .setStringValue("new_key"));
    RecordMetaData metaData2 = RecordMetaData.build(protoBuilder.build());
    assertInvalid("record type key changed", metaData1, metaData2);
}