@SuppressWarnings("unchecked")
    public static RuntimeException unexpectedStateHandleException(
            Class<? extends StateObject> expectedStateHandleClass,
            Class<? extends StateObject> actualStateHandleClass) {
        return unexpectedStateHandleException(
                new Class[] {expectedStateHandleClass}, actualStateHandleClass);
    }
@Test
    @SuppressWarnings("unchecked")
    void unexpectedStateExceptionForMultipleExpectedTypes() {
        Exception exception =
                StateUtil.unexpectedStateHandleException(
                        new Class[] {KeyGroupsStateHandle.class, KeyGroupsStateHandle.class},
                        KeyGroupsStateHandle.class);

        assertThat(exception.getMessage())
                .contains(
                        "Unexpected state handle type, expected one of: class org.apache.flink.runtime.state.KeyGroupsStateHandle, class org.apache.flink.runtime.state.KeyGroupsStateHandle, but found: class org.apache.flink.runtime.state.KeyGroupsStateHandle. This can mostly happen when a different StateBackend from the one that was used for taking a checkpoint/savepoint is used when restoring.");
    }