@Override
    public AllocatedSlotReport createAllocatedSlotReport(ResourceID taskManagerId) {
        assertHasBeenStarted();

        final Collection<AllocatedSlotInfo> allocatedSlotInfos = new ArrayList<>();

        for (SlotInfo slotInfo : declarativeSlotPool.getAllSlotsInformation()) {
            if (slotInfo.getTaskManagerLocation().getResourceID().equals(taskManagerId)) {
                allocatedSlotInfos.add(
                        new AllocatedSlotInfo(
                                slotInfo.getPhysicalSlotNumber(), slotInfo.getAllocationId()));
            }
        }
        return new AllocatedSlotReport(jobId, allocatedSlotInfos);
    }
@Test
    void testCreateAllocatedSlotReport() throws Exception {
        final LocalTaskManagerLocation taskManagerLocation1 = new LocalTaskManagerLocation();
        final LocalTaskManagerLocation taskManagerLocation2 = new LocalTaskManagerLocation();
        final TestingPhysicalSlot testingPhysicalSlot2 =
                createTestingPhysicalSlot(taskManagerLocation2);
        final Collection<SlotInfo> slotInfos =
                Arrays.asList(
                        createTestingPhysicalSlot(taskManagerLocation1), testingPhysicalSlot2);
        try (DeclarativeSlotPoolService declarativeSlotPoolService =
                createDeclarativeSlotPoolService(
                        new TestingDeclarativeSlotPoolFactory(
                                new TestingDeclarativeSlotPoolBuilder()
                                        .setGetAllSlotsInformationSupplier(() -> slotInfos)))) {

            final AllocatedSlotReport allocatedSlotReport =
                    declarativeSlotPoolService.createAllocatedSlotReport(
                            taskManagerLocation2.getResourceID());

            assertThat(allocatedSlotReport.getAllocatedSlotInfos())
                    .allMatch(
                            context ->
                                    context.getAllocationId()
                                                    .equals(testingPhysicalSlot2.getAllocationId())
                                            && context.getSlotIndex()
                                                    == testingPhysicalSlot2
                                                            .getPhysicalSlotNumber());
        }
    }