@Test
public void formerIndexFromThePast() {

    RecordMetaData metaData1 = RecordMetaData.build(TestRecords1Proto.getDescriptor());
    RecordMetaData metaData2 = RecordMetaData.build(
            metaData1.toProto().toBuilder()
                    .setVersion(metaData1.getVersion() + 1)
                    .addFormerIndexes(RecordMetaDataProto.FormerIndex.newBuilder()
                            .setSubspaceKey(ByteString.copyFrom(Tuple.from("dummy_key").pack()))
                            .setRemovedVersion(metaData1.getVersion() - 1)
                            .build())
                    .build()
    );
    assertInvalid("new former index has removed version that is not newer than the old meta-data version", metaData1, metaData2);
    RecordMetaData metaData3 = RecordMetaData.build(
            metaData1.toProto().toBuilder()
                    .setVersion(metaData1.getVersion() + 1)
                    .addFormerIndexes(RecordMetaDataProto.FormerIndex.newBuilder()
                            .setSubspaceKey(ByteString.copyFrom(Tuple.from("dummy_key").pack()))
                            .setRemovedVersion(metaData1.getVersion())
                            .build())
                    .build()
    );
    assertInvalid("new former index has removed version that is not newer than the old meta-data version", metaData1, metaData3);
}