static void verifyPoolState(File reserveFileDir, ExpectedState expectedState) {
    if (expectedState == null) {
      assertFalse("Reserve directory should not exist", reserveFileDir.exists());
    } else {
      assertEquals("Wrong number of dirs", expectedState.storeReserveMap.size() + 1, reserveFileDir.list().length);
      File swapFileDir = new File(reserveFileDir, DiskSpaceAllocator.SWAP_DIR_NAME);
      assertEquals("Wrong number of dirs in swap reserve pool", expectedState.swapMap.size(),
          swapFileDir.list().length);
      for (Map.Entry<Long, Integer> entry : expectedState.swapMap.entrySet()) {
        long size = entry.getKey();
        int count = entry.getValue();
        File fileSizeDir = new File(swapFileDir, DiskSpaceAllocator.generateFileSizeDirName(size));
        String[] filenameList = fileSizeDir.list();
        assertNotNull("Error while listing swap files for size " + size, filenameList);
        assertEquals("Wrong number of swap files for size " + size, count, filenameList.length);
      }
      for (Map.Entry<String, Map<Long, Integer>> entry : expectedState.storeReserveMap.entrySet()) {
        File storeReserveDir = new File(reserveFileDir, DiskSpaceAllocator.STORE_DIR_PREFIX + entry.getKey());
        for (Map.Entry<Long, Integer> sizeToFileNum : entry.getValue().entrySet()) {
          long fileSize = sizeToFileNum.getKey();
          int fileNum = sizeToFileNum.getValue();
          File fileSizeDir = new File(storeReserveDir, DiskSpaceAllocator.generateFileSizeDirName(fileSize));
          String[] filenameList = fileSizeDir.list();
          assertNotNull("Error while listing store " + entry.getKey() + " reserve files for size " + fileSize,
              filenameList);
          assertEquals("Wrong number of store " + entry.getKey() + " reserve files for size " + fileSize, fileNum,
              filenameList.length);
        }
      }
    }
  }
Verify that the layout of the pool matches the expected state.
@param reserveFileDir the reserve file directory to inspect.
@param expectedState an {@link ExpectedState} object that describes the expected number of reserve files for each
                     size, or {@code null} if the directory should not exist.
ambry-store/src/test/java/com/github/ambry/store/DiskSpaceAllocatorTest.java