Interface StreamArbitrary<T>

  • All Superinterfaces:
    Arbitrary<java.util.stream.Stream<T>>, SizableArbitrary<java.util.stream.Stream<T>>, StreamableArbitrary<T,​java.util.stream.Stream<T>>

    @API(status=MAINTAINED,
         since="1.3.2")
    public interface StreamArbitrary<T>
    extends StreamableArbitrary<T,​java.util.stream.Stream<T>>
    Fluent interface to add functionality to arbitraries that generate instances of type Stream
    • Method Detail

      • uniqueElements

        @API(status=MAINTAINED,
             since="1.4.0")
        StreamArbitrary<T> uniqueElements()
        Add the constraint that elements of the generated stream must be unique, i.e. no two elements must return true when being compared using Object.equals(Object).

        The constraint can be combined with other uniqueElements(Function) constraints.

        Returns:
        new arbitrary instance
      • uniqueElements

        @API(status=MAINTAINED,
             since="1.4.0")
        StreamArbitrary<T> uniqueElements​(java.util.function.Function<T,​java.lang.Object> by)
        Add the constraint that elements of the generated stream must be unique relating to an element's "feature" being extracted using the by function. The extracted features are being compared using Object.equals(Object).

        The constraint can be combined with other uniqueElements(Function) constraints.

        Returns:
        new arbitrary instance