public boolean needsAlignment() {
        return isExactlyOnceMode()
                && (getCheckpointType().isSavepoint() || !isUnalignedCheckpoint());
    }
@Test
    void testCheckpointNeedsAlignment() {
        CheckpointStorageLocationReference location =
                CheckpointStorageLocationReference.getDefault();
        assertThat(
                        new CheckpointOptions(
                                        CHECKPOINT,
                                        location,
                                        AlignmentType.UNALIGNED,
                                        NO_ALIGNED_CHECKPOINT_TIME_OUT)
                                .needsAlignment())
                .isFalse();
        assertThat(
                        new CheckpointOptions(
                                        CHECKPOINT,
                                        location,
                                        AlignmentType.ALIGNED,
                                        NO_ALIGNED_CHECKPOINT_TIME_OUT)
                                .needsAlignment())
                .isTrue();
        assertThat(
                        new CheckpointOptions(
                                        CHECKPOINT,
                                        location,
                                        AlignmentType.FORCED_ALIGNED,
                                        NO_ALIGNED_CHECKPOINT_TIME_OUT)
                                .needsAlignment())
                .isTrue();
        assertThat(
                        new CheckpointOptions(
                                        CHECKPOINT,
                                        location,
                                        AlignmentType.AT_LEAST_ONCE,
                                        NO_ALIGNED_CHECKPOINT_TIME_OUT)
                                .needsAlignment())
                .isFalse();
    }