Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking change: stream() semantics when used with stateful generators #869

Merged
merged 1 commit into from
Dec 30, 2023

Commits on Dec 30, 2023

  1. Breaking change: stream() semantics when used with stateful generat…

    …ors.
    
    With this commit, all root objects created by `stream()` are independent
    of each other. This affects the behaviour of `stream()` when used with
    stateful generators such as `emit()`, `intSeq()`, `longSeq()`.
    
    Example:
    
    ```java
    List<String> results = Instancio.of(String.class)
        .generate(allStrings(), gen -> gen.emit().items("foo", "bar", "baz").ignoreUnused())
        .stream()
        .limit(3)
        .toList();
    
    // Original behaviour
    assertThat(results).containsExactly("foo", "bar", "baz");
    
    // New behaviour
    assertThat(results).containsExactly("foo", "foo", "foo");
    ```
    armandino committed Dec 30, 2023
    Configuration menu
    Copy the full SHA
    c58493d View commit details
    Browse the repository at this point in the history