void () { int baseThreshold = PersistentSubIndexerVersionEnumerator.getStorageSizeLimit(); PersistentSubIndexerVersionEnumerator.setStorageSizeLimit(2); try { myMap = new PersistentSubIndexerRetriever<>(myRoot, "index_name", 0, new MyPerFileIndexExtension()); persistIndexedState(foo1); persistIndexedState(boo1); persistIndexedState(bar1); persistIndexedState(baz1); assertTrue(isIndexedState(foo1)); assertTrue(isIndexedState(boo1)); assertTrue(isIndexedState(bar1)); assertTrue(isIndexedState(baz1)); myMap.close(); myMap = new PersistentSubIndexerRetriever<>(myRoot, "index_name", 0, new MyPerFileIndexExtension()); fail(); } catch (IOException ignored) { // it's ok } finally { PersistentSubIndexerVersionEnumerator.setStorageSizeLimit(baseThreshold); } }