@Test
public void dontRenameNonUnionToUnion() {

    try (FDBRecordContext context = fdb.openContext()) {
        openMetaDataStore(context);
        RecordMetaData metaData = RecordMetaData.build(TestRecords1Proto.getDescriptor());
        metaDataStore.saveRecordMetaData(metaData);
        context.commit();
    }
    try (FDBRecordContext context = fdb.openContext()) {
        openMetaDataStore(context);
        renameRecordType(RecordMetaDataBuilder.DEFAULT_UNION_NAME, "RecordOneUnion"); // to avoid conflicts
        MetaDataException e = assertThrows(MetaDataException.class, () -> renameRecordType("MySimpleRecord", RecordMetaDataBuilder.DEFAULT_UNION_NAME));
        assertEquals("Cannot rename record type to the default union name", e.getMessage());
    }
}