@Test
  public void testAllocateFileAlreadyExists() throws Exception {
    String filePath = tempDir.getAbsolutePath() + File.separator + "340_0_log";
    File file = new File(filePath);
    if (file.createNewFile()) {
      assertException(FileStoreException.class, () -> fileStore.allocateFile(filePath, STORE_ID), e -> {
        assertEquals("Unexpected exception thrown",
            new FileStoreException("Error while allocating file in path " + filePath + " for store: " + STORE_ID,
                FileStoreException.FileStoreErrorCode.FileStoreFileAllocationFailed), e);
      });
    } else {
      throw new RuntimeException("Failed to create test file");
    }
  }
Tests the behavior of the allocateFile method when the file already exists.
Expects a FileStoreException to be thrown.
ambry-store/src/test/java/com/github/ambry/store/FileStoreTest.java