@Override
    public MigratablePipeline findPipelineToMigrate(LoadImbalance imbalance) {
        Set<? extends MigratablePipeline> candidates = imbalance.getPipelinesOwnedBy(imbalance.srcOwner);
        int pipelineCount = candidates.size();
        int selected = random.nextInt(pipelineCount);
        Iterator<? extends MigratablePipeline> iterator = candidates.iterator();
        for (int i = 0; i < selected; i++) {
            iterator.next();
        }
        return iterator.next();
    }
@Test
    public void findPipelineToMigrate_shouldWorkEvenWithASinglePipelineAvailable() {
        MigratablePipeline pipeline = mock(MigratablePipeline.class);

        ownerPipelines.put(imbalance.srcOwner, Set.of(pipeline));
        MigratablePipeline pipelineToMigrate = strategy.findPipelineToMigrate(imbalance);
        assertEquals(pipeline, pipelineToMigrate);
    }