private void runInitFailureTest(File directoryToRestrict, boolean restrictRead,
      DiskSpaceRequirements... requirements) {
    if (restrictRead) {
      assertTrue("Could not make unreadable", directoryToRestrict.setReadable(false));
    } else {
      assertTrue("Could not make unwritable", directoryToRestrict.setWritable(false));
    }
    alloc = constructAllocator();
    try {
      alloc.initializePool(Arrays.asList(requirements));
      fail("Expected StoreException");
    } catch (StoreException e) {
      assertEquals("Wrong error code", StoreErrorCodes.InitializationError, e.getErrorCode());
    } finally {
      if (restrictRead) {
        assertTrue("Could not make readable again", directoryToRestrict.setReadable(true));
      } else {
        assertTrue("Could not make writable again", directoryToRestrict.setWritable(true));
      }
    }
  }
Assert that an initialization error occurs when permissions on a reserve directory are modified.
@param directoryToRestrict the directory to make unreadable or unwritable.
@param restrictRead {@code true} to make the directory unreadable, or {@code false} to make it unwritable
@param requirements the {@link DiskSpaceRequirements} to provide to
                    {@link DiskSpaceAllocator#initializePool(Collection)}
ambry-store/src/test/java/com/github/ambry/store/DiskSpaceAllocatorTest.java