@Override
    public boolean isAvailable(final IntermediateResultPartitionID resultPartitionID) {
        return partitionTracker.isPartitionTracked(partitionIDMapper.apply(resultPartitionID));
    }
@Test
    void testPartitionAvailabilityCheck() {

        final IntermediateResultPartitionID irp1ID = new IntermediateResultPartitionID();
        final IntermediateResultPartitionID irp2ID = new IntermediateResultPartitionID();
        final IntermediateResultPartitionID irp3ID = new IntermediateResultPartitionID();
        final IntermediateResultPartitionID irp4ID = new IntermediateResultPartitionID();

        final Map<IntermediateResultPartitionID, Boolean> expectedAvailability =
                new HashMap<IntermediateResultPartitionID, Boolean>() {
                    {
                        put(irp1ID, true);
                        put(irp2ID, false);
                        put(irp3ID, false);
                        put(irp4ID, true);
                    }
                };

        // let the partition tracker respect the expected availability result
        final TestingJobMasterPartitionTracker partitionTracker =
                new TestingJobMasterPartitionTracker();
        partitionTracker.setIsPartitionTrackedFunction(
                rpID -> expectedAvailability.get(rpID.getPartitionId()));

        // the execution attempt ID should make no difference in this case
        final Function<IntermediateResultPartitionID, ResultPartitionID> partitionIDMapper =
                intermediateResultPartitionID ->
                        new ResultPartitionID(
                                intermediateResultPartitionID, createExecutionAttemptId());

        final ResultPartitionAvailabilityChecker resultPartitionAvailabilityChecker =
                new ExecutionGraphResultPartitionAvailabilityChecker(
                        partitionIDMapper, partitionTracker);

        for (IntermediateResultPartitionID irpID : expectedAvailability.keySet()) {
            assertThat(expectedAvailability.get(irpID))
                    .isEqualTo(resultPartitionAvailabilityChecker.isAvailable(irpID));
        }
    }