Schnittstelle StreamableArbitrary<T extends @Nullable Object,U>

Alle Superschnittstellen:
Arbitrary<U>, SizableArbitrary<U>
Alle bekannten Unterschnittstellen:
ArrayArbitrary<T,A>, IteratorArbitrary<T>, ListArbitrary<T>, SetArbitrary<T>, StreamArbitrary<T>

@API(status=MAINTAINED, since="1.2.1") public interface StreamableArbitrary<T extends @Nullable Object,U> extends SizableArbitrary<U>
Fluent interface to add functionality to arbitraries whose generation artefacts can be streamed, e.g. List, Set, Stream and Arrays
  • Methodendetails

    • reduce

      <R extends @Nullable Object> Arbitrary<R> reduce(R initial, BiFunction<R,? super T,R> accumulator)
      Given an initial argument use accumulator to produce the final result.
      Typparameter:
      R - The result type
      Parameter:
      initial - The initial argument. Also the result if streamable is empty
      accumulator - The function used to reduce a streamable into a result one by one
      Gibt zurück:
      The result of accumulating all elements in streamable
    • ofSize

      default StreamableArbitrary<T,U> ofSize(int size)
      Fix the size to size.
      Angegeben von:
      ofSize in Schnittstelle SizableArbitrary<T extends @Nullable Object>
    • ofMinSize

      StreamableArbitrary<T,U> ofMinSize(int minSize)
      Set lower size boundary minSize (included).
      Angegeben von:
      ofMinSize in Schnittstelle SizableArbitrary<T extends @Nullable Object>
    • ofMaxSize

      StreamableArbitrary<T,U> ofMaxSize(int maxSize)
      Set upper size boundary maxSize (included).
      Angegeben von:
      ofMaxSize in Schnittstelle SizableArbitrary<T extends @Nullable Object>
    • withSizeDistribution

      @API(status=EXPERIMENTAL, since="1.5.3") StreamableArbitrary<T,U> withSizeDistribution(RandomDistribution distribution)
      Set distribution distribution of size of generated arbitrary
      Angegeben von:
      withSizeDistribution in Schnittstelle SizableArbitrary<T extends @Nullable Object>
    • uniqueElements

      @API(status=MAINTAINED, since="1.7.3") StreamableArbitrary<T,U> uniqueElements()
      Add the constraint that elements of the generated streamable 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.

      Gibt zurück:
      new arbitrary instance
    • uniqueElements

      @API(status=MAINTAINED, since="1.7.3") StreamableArbitrary<T,U> uniqueElements(Function<? super T,?> by)
      Add the constraint that elements of the generated streamable 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.

      Gibt zurück:
      new arbitrary instance