private File allocateAndVerify(String storeId, String filename, long size, boolean isSwapSegment) throws Exception {
    File file = new File(allocatedFileDir, filename);
    alloc.allocate(file, size, storeId, isSwapSegment);
    assertTrue("Allocated file should exist: " + file.getAbsolutePath(), file.exists());
    assertTrue("Allocated file should be a file and not a directory: " + file.getAbsolutePath(), file.isFile());
    assertTrue("Allocated file should be writable: " + file.getAbsolutePath(), file.canWrite());
    return file;
  }
Allocate a file and check for existence and write permissions.
@param storeId the id of store for which is file is allocated.
@param filename the name of the destination file. This file will be created in the allocated file directory.
@param size the size of the file to allocate.
@param isSwapSegment whether this is a swap segment to allocate.
@return a {@link File} object for the allocated file.
@throws Exception
ambry-store/src/test/java/com/github/ambry/store/DiskSpaceAllocatorTest.java