@Test
public void newIndexFromThePast() {

    RecordMetaData metaData1 = RecordMetaData.build(TestRecords1Proto.getDescriptor());
    Index newIndex = new Index("newIndex", Key.Expressions.field("num_value_2"));
    newIndex.setAddedVersion(metaData1.getVersion() - 1);
    newIndex.setLastModifiedVersion(metaData1.getVersion() - 1);
    RecordMetaDataBuilder metaData2Builder = RecordMetaData.newBuilder().setRecords(TestRecords1Proto.getDescriptor());
    metaData2Builder.addIndex(metaData2Builder.getRecordType("MySimpleRecord"), newIndex);
    metaData2Builder.setVersion(metaData1.getVersion() + 1);
    RecordMetaData metaData2 = metaData2Builder.getRecordMetaData();
    assertInvalid("new index has version that is not newer than the old meta-data version", metaData1, metaData2);
    RecordMetaDataBuilder metaData3Builder = RecordMetaData.newBuilder().setRecords(TestRecords1Proto.getDescriptor());
    newIndex.setAddedVersion(metaData1.getVersion());
    metaData3Builder.addIndex(metaData2Builder.getRecordType("MySimpleRecord"), newIndex);
    metaData2Builder.setVersion(metaData1.getVersion() + 1);
    RecordMetaData metaData3 = metaData2.getRecordMetaData();
    assertInvalid("new index has version that is not newer than the old meta-data version", metaData1, metaData3);
}