The ``doWithWriter`` in ``mockedIndexCorruptException`` and ``mockedIndexIOException`` are almost identical (the only difference being the exception being thrown), it would be good to extract the common logic.