public DiscardObject markAsDiscardedOnShutdown(JobStatus jobStatus) {
        return shouldBeDiscardedOnShutdown(jobStatus) ? markAsDiscarded() : NOOP_DISCARD_OBJECT;
    }
@Test
    void testCompletedCheckpointStatsCallbacks() throws Exception {
        Map<JobVertexID, TaskStateStats> taskStats = new HashMap<>();
        JobVertexID jobVertexId = new JobVertexID();
        taskStats.put(jobVertexId, new TaskStateStats(jobVertexId, 1));
        CompletedCheckpointStats checkpointStats =
                new CompletedCheckpointStats(
                        1,
                        0,
                        CheckpointProperties.forCheckpoint(
                                CheckpointRetentionPolicy.NEVER_RETAIN_AFTER_TERMINATION),
                        1,
                        taskStats,
                        1,
                        1,
                        1,
                        1,
                        true,
                        mock(SubtaskStateStats.class),
                        null);
        CompletedCheckpoint completed =
                new CompletedCheckpoint(
                        new JobID(),
                        0,
                        0,
                        1,
                        Collections.emptyMap(),
                        Collections.emptyList(),
                        CheckpointProperties.forCheckpoint(
                                CheckpointRetentionPolicy.NEVER_RETAIN_AFTER_TERMINATION),
                        new TestCompletedCheckpointStorageLocation(),
                        checkpointStats);

        completed.markAsDiscardedOnShutdown(JobStatus.FINISHED).discard();
        assertThat(checkpointStats.isDiscarded()).isTrue();
    }