public Collection<ResultPartitionID> stopTrackingPartitions(K key) {
        Preconditions.checkNotNull(key);

        Set<ResultPartitionID> storedPartitions = trackedPartitionsPerKey.remove(key);
        return storedPartitions == null ? Collections.emptyList() : storedPartitions;
    }
@Test
    void testStopTrackingPartitions() {
        final ResultPartitionID partitionId2 = new ResultPartitionID();
        final PartitionTable<JobID> table = new PartitionTable<>();

        table.startTrackingPartitions(JOB_ID, Collections.singletonList(PARTITION_ID));
        table.startTrackingPartitions(JOB_ID, Collections.singletonList(partitionId2));

        table.stopTrackingPartitions(JOB_ID, Collections.singletonList(partitionId2));
        assertThat(table.hasTrackedPartitions(JOB_ID)).isTrue();

        Collection<ResultPartitionID> storedPartitions = table.stopTrackingPartitions(JOB_ID);
        assertThat(storedPartitions).contains(PARTITION_ID);
        assertThat(table.hasTrackedPartitions(JOB_ID)).isFalse();
    }