@Test
  public void invalidReserveFileDirTest() throws Exception {
    assertTrue("Could not create file", reserveFileDir.createNewFile());
    alloc = constructAllocator();
    // Should still allow allocation of non-pooled files before init.
    File f1 = allocateAndVerify(storeId0, "file1", 5, false);
    freeAndVerify(storeId0, f1, 5, false);
    assertFalse("Reserve file dir should not have been created if a file already exists at that path",
        reserveFileDir.isDirectory());
    try {
      alloc.initializePool(Collections.emptyList());
      fail("Expected StoreException");
    } catch (StoreException e) {
      assertEquals("Wrong error code", StoreErrorCodes.InitializationError, e.getErrorCode());
    }
    // Should still allow allocation of non-pooled files even after init failure.
    File f2 = allocateAndVerify(storeId0, "file1", 5, false);
    freeAndVerify(storeId0, f2, 5, false);
    assertFalse("Reserve file dir should not have been created if a file already exists at that path",
        reserveFileDir.isDirectory());
  }
This tests the case where we cannot create a reserve file directory, because a normal file at that path already
exists.
@throws Exception
ambry-store/src/test/java/com/github/ambry/store/DiskSpaceAllocatorTest.java