@Nonnull
    public SerializedCheckpointException getSerializedCheckpointException() {
        return serializedCheckpointException;
    }
@Test
    void testDeclineCheckpointWithUserExceptionCanBeDeserializedWithoutUserClass()
            throws Exception {
        final String className = "UserException";
        final URLClassLoader userClassLoader =
                ClassLoaderUtils.compileAndLoadJava(
                        TempDirUtils.newFolder(tempDir),
                        className + ".java",
                        String.format(
                                "public class %s extends RuntimeException { public %s() {super(\"UserMessage\");} }",
                                className, className));

        Throwable userException =
                (Throwable) Class.forName(className, false, userClassLoader).newInstance();

        CheckpointException checkpointException =
                new CheckpointException(CheckpointFailureReason.CHECKPOINT_DECLINED, userException);

        final byte[] serializedCheckpointMessage =
                InstantiationUtil.serializeObject(
                        new DeclineCheckpoint(
                                new JobID(), createExecutionAttemptId(), 1, checkpointException));
        final DeclineCheckpoint deserializedCheckpointMessage =
                InstantiationUtil.deserializeObject(
                        serializedCheckpointMessage, ClassLoader.getSystemClassLoader());

        Throwable throwable =
                deserializedCheckpointMessage.getSerializedCheckpointException().unwrap();
        assertThat(throwable).isInstanceOf(CheckpointException.class);
        Optional<Throwable> throwableWithMessage =
                ExceptionUtils.findThrowableWithMessage(throwable, userException.getMessage());
        assertThat(throwableWithMessage)
                .isPresent()
                .hasValueSatisfying(
                        throwable1 ->
                                assertThat(throwable1)
                                        .hasMessage(
                                                String.format(
                                                        "%s: %s",
                                                        userException.getClass().getName(),
                                                        userException.getMessage())));
    }