@Override
    public AllocatedSlotsAndReservationStatus removeSlots(ResourceID owner) {
        final Set<AllocationID> slotsOfTaskExecutor = slotsPerTaskExecutor.remove(owner);

        if (slotsOfTaskExecutor != null) {
            final Collection<AllocatedSlot> removedSlots = new ArrayList<>();
            final Map<AllocationID, ReservationStatus> removedSlotsReservationStatus =
                    new HashMap<>();

            for (AllocationID allocationId : slotsOfTaskExecutor) {
                final ReservationStatus reservationStatus =
                        containsFreeSlot(allocationId)
                                ? ReservationStatus.FREE
                                : ReservationStatus.RESERVED;

                final AllocatedSlot removedSlot =
                        Preconditions.checkNotNull(removeSlotInternal(allocationId));
                removedSlots.add(removedSlot);
                removedSlotsReservationStatus.put(removedSlot.getAllocationId(), reservationStatus);
            }

            return new DefaultAllocatedSlotsAndReservationStatus(
                    removedSlots, removedSlotsReservationStatus);
        } else {
            return new DefaultAllocatedSlotsAndReservationStatus(
                    Collections.emptyList(), Collections.emptyMap());
        }
    }
@Test
    void testRemoveSlots() {
        final DefaultAllocatedSlotPool slotPool = new DefaultAllocatedSlotPool();

        final ResourceID owner = ResourceID.generate();
        final Collection<AllocatedSlot> slots = createAllocatedSlotsWithOwner(owner);
        final AllocatedSlot otherSlot = createAllocatedSlot(ResourceID.generate());
        slots.add(otherSlot);

        slotPool.addSlots(slots, 0);

        slotPool.removeSlots(owner);

        assertSlotPoolContainsSlots(slotPool, Collections.singleton(otherSlot));
    }