public static ResourceProfile generateDefaultSlotResourceProfile(
            WorkerResourceSpec workerResourceSpec, int numSlotsPerWorker) {
        final ResourceProfile.Builder resourceProfileBuilder =
                ResourceProfile.newBuilder()
                        .setCpuCores(workerResourceSpec.getCpuCores().divide(numSlotsPerWorker))
                        .setTaskHeapMemory(
                                workerResourceSpec.getTaskHeapSize().divide(numSlotsPerWorker))
                        .setTaskOffHeapMemory(
                                workerResourceSpec.getTaskOffHeapSize().divide(numSlotsPerWorker))
                        .setManagedMemory(
                                workerResourceSpec.getManagedMemSize().divide(numSlotsPerWorker))
                        .setNetworkMemory(
                                workerResourceSpec.getNetworkMemSize().divide(numSlotsPerWorker));
        workerResourceSpec
                .getExtendedResources()
                .forEach(
                        (name, resource) ->
                                resourceProfileBuilder.setExtendedResource(
                                        resource.divide(numSlotsPerWorker)));
        return resourceProfileBuilder.build();
    }
@Test
    void testGenerateDefaultSlotConsistentWithTaskExecutorResourceUtils() {
        final int numSlots = 5;
        final TaskExecutorResourceSpec taskExecutorResourceSpec =
                new TaskExecutorResourceSpec(
                        new CPUResource(1.0),
                        MemorySize.parse("1m"),
                        MemorySize.parse("2m"),
                        MemorySize.parse("3m"),
                        MemorySize.parse("4m"),
                        Collections.singleton(
                                new ExternalResource(EXTERNAL_RESOURCE_NAME, numSlots)));

        final ResourceProfile resourceProfileFromTaskExecutorResourceUtils =
                TaskExecutorResourceUtils.generateDefaultSlotResourceProfile(
                        taskExecutorResourceSpec, numSlots);

        final ResourceProfile totalResourceProfile =
                TaskExecutorResourceUtils.generateTotalAvailableResourceProfile(
                        taskExecutorResourceSpec);
        final WorkerResourceSpec workerResourceSpec =
                WorkerResourceSpec.fromTotalResourceProfile(totalResourceProfile, numSlots);

        assertThat(
                        SlotManagerUtils.generateDefaultSlotResourceProfile(
                                totalResourceProfile, numSlots))
                .isEqualTo(resourceProfileFromTaskExecutorResourceUtils);
        assertThat(
                        SlotManagerUtils.generateDefaultSlotResourceProfile(
                                workerResourceSpec, numSlots))
                .isEqualTo(resourceProfileFromTaskExecutorResourceUtils);
    }