@Override
    public Collection<SlotAllocationSnapshot> loadAllocationSnapshots() {
        // Let's try to populate the slot allocation from local file
        final File[] slotAllocationFiles = slotAllocationSnapshotDirectory.listFiles();
        if (slotAllocationFiles == null) {
            LOG.debug("No allocation files to load.");
            return Collections.emptyList();
        }

        Collection<SlotAllocationSnapshot> slotAllocationSnapshots =
                new ArrayList<>(slotAllocationFiles.length);

        for (File allocationFile : slotAllocationFiles) {
            try (ObjectInputStream ois =
                    new ObjectInputStream(new FileInputStream(allocationFile))) {
                slotAllocationSnapshots.add((SlotAllocationSnapshot) ois.readObject());
            } catch (IOException | ClassNotFoundException e) {
                LOG.debug(
                        "Cannot read the local allocations state file {}. Deleting it now.",
                        allocationFile.toPath(),
                        e);
                deleteAllocationSnapshot(filenameToSlotIndex(allocationFile.getName()));
            }
        }

        return slotAllocationSnapshots;
    }
@Test
    void loadNoSlotAllocationSnapshotsIfDirectoryIsEmpty() throws IOException {
        assumeTrue(FileUtils.isEmptyDirectory(tempDirectory));

        final FileSlotAllocationSnapshotPersistenceService persistenceService =
                new FileSlotAllocationSnapshotPersistenceService(tempDirectory);

        assertThat(persistenceService.loadAllocationSnapshots()).isEmpty();
    }