Interface EmitGeneratorSpec<T>

All Superinterfaces:
GeneratorSpec<T>

@ExperimentalApi public interface EmitGeneratorSpec<T> extends GeneratorSpec<T>
A generator spec that emits given items to a selector's target.
Since:
2.12.0
  • Method Details

    • items

      EmitGeneratorSpec<T> items(T... items)
      Emit given items.

      This method can be invoked multiple times to add more items to emit.

      Parameters:
      items - to emit, null array is not allowed, but the array itself may contain null elements unless the target is a Map key
      Returns:
      spec builder
      Since:
      2.12.0
      See Also:
    • items

      EmitGeneratorSpec<T> items(Iterable<? extends T> items)
      Emit given items.

      This method can be invoked multiple times to add more items to emit.

      Parameters:
      items - to emit, null iterable is not allowed, but the iterable itself may contain null elements unless the target is a Map key
      Returns:
      spec builder
      Since:
      2.13.0
      See Also:
    • item

      EmitGeneratorSpec<T> item(T item, int n)
      Emit given item n number of times.

      This method can be invoked multiple times and combined with items(Object[]).

      Parameters:
      item - to emit, null allowed unless the target is a Map key
      n - number of times the item should be emitted; must not be negative
      Returns:
      spec builder
      Since:
      2.12.0
      See Also:
    • shuffle

      EmitGeneratorSpec<T> shuffle()
      Specifies that items should be emitted in random order.
      Returns:
      spec builder
      Since:
      2.12.0
    • ignoreUnused

      EmitGeneratorSpec<T> ignoreUnused()
      Specifies that if any of the provided items were not emitted, they should be ignored (the default is to throw an exception).
      Returns:
      spec builder
      Since:
      2.12.0
    • whenEmptyEmitNull

      EmitGeneratorSpec<T> whenEmptyEmitNull()
      Specifies that null should be generated if an insufficient number of items were provided.
      Returns:
      spec builder
      Since:
      2.12.0
    • whenEmptyEmitRandom

      EmitGeneratorSpec<T> whenEmptyEmitRandom()
      Specifies that a random value should be generated if an insufficient number of items were provided (default behaviour).
      Returns:
      spec builder
      Since:
      2.12.0
    • whenEmptyThrowException

      EmitGeneratorSpec<T> whenEmptyThrowException()
      Specifies that an exception should be raised if an insufficient number of items were provided.
      Returns:
      spec builder
      Since:
      2.12.0
    • whenEmptyRecycle

      EmitGeneratorSpec<T> whenEmptyRecycle()
      Specifies that the same items should be re-emitted again if provided items are exhausted.
      Returns:
      spec builder
      Since:
      4.3.0