public static <T> StateSerializerProvider<T> fromPreviousSerializerSnapshot(
            TypeSerializerSnapshot<T> stateSerializerSnapshot) {
        return new LazilyRegisteredStateSerializerProvider<>(stateSerializerSnapshot);
    }
@Test
    void testLazyInstantiationOfPreviousSchemaSerializer() {
        // create the provider with an exception throwing snapshot;
        // this would throw an exception if the restore serializer was eagerly accessed
        StateSerializerProvider<String> testProvider =
                StateSerializerProvider.fromPreviousSerializerSnapshot(
                        new ExceptionThrowingSerializerSnapshot());

        // if we fail here, that means the restore serializer was indeed lazily accessed
        assertThatThrownBy(testProvider::previousSchemaSerializer)
                .withFailMessage("expected to fail when accessing the restore serializer.")
                .isInstanceOf(UnsupportedOperationException.class);
    }