Interface MockUnit<T>

All Known Subinterfaces:
MockUnitDays, MockUnitDouble, MockUnitFloat, MockUnitInt, MockUnitLocalDate, MockUnitLong, MockUnitMonth, MockUnitString
All Known Implementing Classes:
Actors, Actresses, Bools, Cars, Celebrities, Chars, Constant, Constructor, Countries, Creatures, CreditCards, CSVs, CVVS, Days, Departments, Domains, Doubles, Emails, Factory, Filler, Floats, Formatter, Genders, IBANs, Industries, Ints, IntSeq, IPv4s, IPv6s, ISSNS, JazzArtists, LocalDates, Longs, LongSeq, Macs, Markovs, Mimes, Money, Months, Names, NaughtyStrings, ObjectMap, Passwords, Primes, Probabilities, Reflect, Regex, RockStars, Seq, Space, SQLInserts, SSCs, Strings, UKPrimeMinisters, URLs, Users, USPresidents, USStates, UUIDs, Words
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface
public interface MockUnit<T>
  • Method Summary

    Modifier and Type Method Description
    default MockUnit<T[]> array​(java.lang.Class<T> cls, int size)
    Transforms a MockUnit<T> into a MockUnit<T[]>.
    default MockUnit<T[]> array​(java.util.function.Supplier<T[]> arraySupplier)
    Transforms a MockUnit<T> into a MockUnit<T[]>.
    default MockUnit<java.util.Collection<T>> collection​(int size)
    Transforms a MockUnit<T> into a MockUnit<Collection<T>>.
    default MockUnit<java.util.Collection<T>> collection​(java.lang.Class<? extends java.util.Collection> collectionClass, int size)
    Deprecated.
    default MockUnit<java.util.Collection<T>> collection​(java.lang.Class<? extends java.util.Collection> collectionClass, MockUnitInt sizeUnit)
    Deprecated.
    default MockUnit<java.util.Collection<T>> collection​(java.util.function.Supplier<java.util.Collection<T>> collectionSupplier, int size)
    Transforms a MockUnit<T> into a MockUnit<Collection<T>>.
    default MockUnit<java.util.Collection<T>> collection​(java.util.function.Supplier<java.util.Collection<T>> collectionSupplier, MockUnitInt sizeUnit)
    Transforms a MockUnit<T> into a MockUnit<Collection<T>>.
    default MockUnit<java.util.Collection<T>> collection​(MockUnitInt sizeUnit)
    Transforms a MockUnit<T> into a MockUnit<Collection<T>>.
    default void consume​(int times, java.util.function.BiConsumer<java.lang.Integer,​T> biConsumer)
    Passes the arbitrary generated values to a BiConsumer<Integer, T> a number of times.
    default void consume​(java.util.function.Consumer<T> consumer)
    Passes the arbitrary generated value to a Consumer<T>.
    default T get()
    Returns the generated value as defined by the chain of constraints.
    default <R> R get​(java.util.function.Function<T,​R> function)
    Returns the generated value, after it applies the supplied Function<T, R>
    default MockUnit<java.util.List<T>> list​(int size)
    Transforms a MockUnit<T> into a MockUnit<List<T>>.
    default MockUnit<java.util.List<T>> list​(java.lang.Class<? extends java.util.List> listClass, int size)
    Deprecated.
    use list(Supplier, int) instead.
    default MockUnit<java.util.List<T>> list​(java.lang.Class<? extends java.util.List> listClass, MockUnitInt sizeUnit)
    Deprecated.
    default MockUnit<java.util.List<T>> list​(java.util.function.Supplier<java.util.List<T>> listSupplier, int size)
    Transforms a MockUnit<T> into a MockUnit<List<T>>.
    default MockUnit<java.util.List<T>> list​(java.util.function.Supplier<java.util.List<T>> listSupplier, MockUnitInt sizeUnit)
    Transforms a MockUnit<T> into a MockUnit<List<T>>.
    default MockUnit<java.util.List<T>> list​(MockUnitInt sizeUnit)
    Transforms a MockUnit<T> into a MockUnit<List<T>>.
    default <R> MockUnit<R> map​(java.util.function.Function<T,​R> function)
    This method can be used in order to add intermediary processing before generating the value <T>.
    default MockUnit<java.util.Map<java.lang.Double,​T>> mapKeys​(double[] keys)
    Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given array.
    default MockUnit<java.util.Map<java.lang.Integer,​T>> mapKeys​(int[] keys)
    Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given array.
    default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(int size, java.util.function.Supplier<R> keysSupplier)
    Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given Supplier<R>.
    default MockUnit<java.util.Map<java.lang.Long,​T>> mapKeys​(long[] keys)
    Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given array.
    default MockUnit<java.util.Map<java.lang.Double,​T>> mapKeys​(java.lang.Class<? extends java.util.Map> mapClass, double[] keys)
    Deprecated.
    default MockUnit<java.util.Map<java.lang.Integer,​T>> mapKeys​(java.lang.Class<? extends java.util.Map> mapClass, int[] keys)
    Deprecated.
    default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(java.lang.Class<? extends java.util.Map> mapClass, int size, java.util.function.Supplier<R> keysSupplier)
    Deprecated.
    default MockUnit<java.util.Map<java.lang.Long,​T>> mapKeys​(java.lang.Class<? extends java.util.Map> mapClass, long[] keys)
    Deprecated.
    default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(java.lang.Class<? extends java.util.Map> mapClass, java.lang.Iterable<R> keys)
    Deprecated.
    default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(java.lang.Class<? extends java.util.Map> mapClass, MockUnitInt sizeUnit, java.util.function.Supplier<R> keysSupplier)
    default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(java.lang.Class<? extends java.util.Map> mapClass, R[] keys)
    Deprecated.
    default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(java.lang.Iterable<R> keys)
    Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given Iterable<R>.
    default MockUnit<java.util.Map<java.lang.Double,​T>> mapKeys​(java.util.function.Supplier<java.util.Map<java.lang.Double,​T>> mapSupplier, double[] keys)
    Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given array.
    default MockUnit<java.util.Map<java.lang.Integer,​T>> mapKeys​(java.util.function.Supplier<java.util.Map<java.lang.Integer,​T>> mapSupplier, int[] keys)
    Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given array.
    default MockUnit<java.util.Map<java.lang.Long,​T>> mapKeys​(java.util.function.Supplier<java.util.Map<java.lang.Long,​T>> mapSupplier, long[] keys)
    Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given array.
    default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(java.util.function.Supplier<java.util.Map<R,​T>> mapSupplier, int size, java.util.function.Supplier<R> keySupplier)
    Transforms a MockUnit<T> into a MockUnit<Map<R,T> where the keys are generated from a given Supplier<R>.
    default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(java.util.function.Supplier<java.util.Map<R,​T>> mapSupplier, java.lang.Iterable<R> keys)
    Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given Iterable<R>.
    default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(java.util.function.Supplier<java.util.Map<R,​T>> mapSupplier, MockUnitInt sizeUnit, java.util.function.Supplier<R> keySupplier)
    Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given Supplier<R>.
    default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(java.util.function.Supplier<java.util.Map<R,​T>> mapSupplier, R[] keys)
    Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given Iterable<R>.
    default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(MockUnitInt sizeUnit, java.util.function.Supplier<R> keysSupplier)
    Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given Supplier<R>.
    default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(R[] keys)
    Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given array.
    default MockUnitDouble mapToDouble​(java.util.function.ToDoubleFunction<T> function)
    This method is used to transform a MockUnit into a MockUnitDouble.
    default MockUnitInt mapToInt​(java.util.function.ToIntFunction<T> function)
    This method is used to transform a MockUnit into a MockUnitInt.
    default MockUnitLocalDate mapToLocalDate​(java.util.function.Function<T,​java.time.LocalDate> dateTransformer)
    This method is used to transform a MockUnit into a MOckUnitLocaldate.
    default MockUnitLong mapToLong​(java.util.function.ToLongFunction<T> function)
    This method is used to transform a MockUnit into a MockUnitLong.
    default MockUnitString mapToString()
    This method is used to transform a MockUnit into a MockUnitString by calling the Object.toString() method.
    default MockUnitString mapToString​(java.util.function.Function<T,​java.lang.String> function)
    This method is used to transform a MockUnit into a MockUnitString.
    default MockUnit<java.util.Map<T,​java.lang.Double>> mapVals​(double[] values)
    Transforms a MockUnit<T> into a MockUnit<T,R> where the values are generated from an array.
    default MockUnit<java.util.Map<T,​java.lang.Integer>> mapVals​(int[] values)
    Transforms a MockUnit<T> into a MockUnit<T,Integer> where the values are generated from an array.
    default <R> MockUnit<java.util.Map<T,​R>> mapVals​(int size, java.util.function.Supplier<R> valuesSupplier)
    Transforms a MockUnit<T> into a MockUnit<T,R> where the values generated from a Supplier<R>.
    default MockUnit<java.util.Map<T,​java.lang.Long>> mapVals​(long[] values)
    Transforms a MockUnit<T> into a MockUnit<T,R> where the values are generated from an array.
    default MockUnit<java.util.Map<T,​java.lang.Double>> mapVals​(java.lang.Class<? extends java.util.Map> mapClass, double[] values)
    Deprecated.
    default MockUnit<java.util.Map<T,​java.lang.Integer>> mapVals​(java.lang.Class<? extends java.util.Map> mapClass, int[] values)
    Deprecated.
    default <R> MockUnit<java.util.Map<T,​R>> mapVals​(java.lang.Class<? extends java.util.Map> mapClass, int size, java.util.function.Supplier<R> valuesSupplier)
    Deprecated.
    default MockUnit<java.util.Map<T,​java.lang.Long>> mapVals​(java.lang.Class<? extends java.util.Map> mapClass, long[] values)
    Deprecated.
    default <R> MockUnit<java.util.Map<T,​R>> mapVals​(java.lang.Class<? extends java.util.Map> mapClass, java.lang.Iterable<R> values)
    Deprecated.
    default <R> MockUnit<java.util.Map<T,​R>> mapVals​(java.lang.Class<? extends java.util.Map> mapClass, MockUnitInt sizeUnit, java.util.function.Supplier<R> valuesSupplier)
    default <R> MockUnit<java.util.Map<T,​R>> mapVals​(java.lang.Class<? extends java.util.Map> mapClass, R[] values)
    Deprecated.
    default <R> MockUnit<java.util.Map<T,​R>> mapVals​(java.lang.Iterable<R> values)
    Transforms a MockUnit<T> into a MockUnit<T,R> where the values are generated from a Iterable<R>.
    default MockUnit<java.util.Map<T,​java.lang.Double>> mapVals​(java.util.function.Supplier<java.util.Map<T,​java.lang.Double>> mapSupplier, double[] values)
    Transforms a MockUnit<T> into a MockUnit<T,Double> where the values are generated from an array.
    default MockUnit<java.util.Map<T,​java.lang.Integer>> mapVals​(java.util.function.Supplier<java.util.Map<T,​java.lang.Integer>> mapSupplier, int[] values)
    Transforms a MockUnit<T> into a MockUnit<T,Integer> where the values are generated from an array.
    default MockUnit<java.util.Map<T,​java.lang.Long>> mapVals​(java.util.function.Supplier<java.util.Map<T,​java.lang.Long>> mapSupplier, long[] values)
    Transforms a MockUnit<T> into a MockUnit<T,Long> where the values are generated from an array.
    default <R> MockUnit<java.util.Map<T,​R>> mapVals​(java.util.function.Supplier<java.util.Map<T,​R>> mapSupplier, int size, java.util.function.Supplier<R> valuesSupplier)
    Transforms a MockUnit<T> into a MockUnit<T,R> where the values generated from a Supplier<R>.
    default <R> MockUnit<java.util.Map<T,​R>> mapVals​(java.util.function.Supplier<java.util.Map<T,​R>> mapSupplier, java.lang.Iterable<R> values)
    Transforms a MockUnit<T> into a MockUnit<T,R> where the values generated from a Iterable<R>.
    default <R> MockUnit<java.util.Map<T,​R>> mapVals​(java.util.function.Supplier<java.util.Map<T,​R>> mapSupplier, MockUnitInt sizeUnit, java.util.function.Supplier<R> valuesSupplier)
    Transforms a MockUnit<T> into a MockUnit<T,R> where the values generated from a Supplier<R>.
    default <R> MockUnit<java.util.Map<T,​R>> mapVals​(java.util.function.Supplier<java.util.Map<T,​R>> mapSupplier, R[] values)
    Transforms a MockUnit<T> into a MockUnit<T,R> where the values are generated from an array.
    default <R> MockUnit<java.util.Map<T,​R>> mapVals​(MockUnitInt sizeUnit, java.util.function.Supplier<R> valuesSupplier)
    Transforms a MockUnit<T> into a MockUnit<T,R> where the values generated from a Supplier<R>.
    default <R> MockUnit<java.util.Map<T,​R>> mapVals​(R[] values)
    Transforms a MockUnit<T> into a MockUnit<T,R> where the values are generated from an array.
    default void serialize​(java.lang.String path)
    Serializes the generated value <T> into a file.
    default MockUnit<java.util.Set<T>> set​(int size)
    Transforms a MockUnit<T> into a MockUnit<Set<T>>.
    default MockUnit<java.util.Set<T>> set​(java.lang.Class<? extends java.util.Set> setClass, int size)
    Deprecated.
    since 0.4.2 use set(Supplier, int) instead
    default MockUnit<java.util.Set<T>> set​(java.lang.Class<? extends java.util.Set> setClass, MockUnitInt sizeUnit)
    Deprecated.
    default MockUnit<java.util.Set<T>> set​(java.util.function.Supplier<java.util.Set<T>> setSupplier, int size)
    Transforms a MockUnit<T> into a MockUnit<Set<T>>.
    default MockUnit<java.util.Set<T>> set​(java.util.function.Supplier<java.util.Set<T>> setSupplier, MockUnitInt sizeUnit)
    Transforms a MockUnit<T> into a MockUnit<Set<T>>.
    default MockUnit<java.util.Set<T>> set​(MockUnitInt sizeUnit)
    Transforms a MockUnit<T> into a MockUnit<Set<T>>.
    default MockUnit<java.util.stream.Stream<T>> stream()
    Transforms a MockUnit<T> into a MockUnit<Stream<T>>.
    java.util.function.Supplier<T> supplier()
    This is the sole abstract method of the interface.
    default T val()
    Returns the generated value as defined by the chain of constraints.
    default <R> R val​(java.util.function.Function<T,​R> function)
    Returns the generated value, after it applies the supplied Function<T, R>
    default java.lang.String valStr()
    Before retrieving the generated value, this method calls Object.toString() on <T>.
    default java.lang.String valStr​(java.lang.String valueIfNull)
    The method is calling Object.toString() of the generated value.
  • Method Details

    • supplier

      java.util.function.Supplier<T> supplier()
      This is the sole abstract method of the interface. Needs to be implemented every-time a MockUnit is implemented.
      Returns:
      A Supplier<T>.
    • val

      default T val()

      Returns the generated value as defined by the chain of constraints. This is a closing method.

      Each subsequent call will trigger the generating mechanism and potentially will return a distinct value from the previous one.

      Returns:
      The generated value.
    • get

      default T get()

      Returns the generated value as defined by the chain of constraints. This is a closing method.

      Each subsequent call will trigger the generating mechanism and potentially will return a distinct value from the previous one.

      In some JVM languages val is a restricted keyword so get() was introduced as an alias for the val() method.
      Returns:
      The generated value
    • serialize

      default void serialize​(java.lang.String path) throws java.io.IOException

      Serializes the generated value <T> into a file.

      The method uses the standard Java serialization mechanism.

      Note: If the specified path is not accessible a UncheckedIOException is thrown.

      Parameters:
      path - The path of the file where to serialize the generated value.
      Throws:
      java.io.IOException - when the serialisation of the object is not achievable and the file cannot be written on the disk
    • val

      default <R> R val​(java.util.function.Function<T,​R> function)

      Returns the generated value, after it applies the supplied Function<T, R>

      Each subsequent call will trigger the generating mechanism and potentially will return a distinct value from the previous one.

      Type Parameters:
      R - The type of the newly returned MockUnit. Can be the same as </T>
      Parameters:
      function - The Function<T,R> applied to the generated value. <T> and <R> can be the same type.
      Returns:
      A new pre-processed arbitrary value of type <R>.
    • get

      default <R> R get​(java.util.function.Function<T,​R> function)

      Returns the generated value, after it applies the supplied Function<T, R>

      Each subsequent call will trigger the generating mechanism and potentially will return a distinct value from the previous one.

      In some JVM languages val is a restricted keyword so get() was introduced as an alias for the val() method.
      Type Parameters:
      R - The type of the newly returned MockUnit. Can be the same as </T>
      Parameters:
      function - The Function<T,R> applied to the generated value. <T> and <R> can be the same type.
      Returns:
      A new pre-processed arbitrary value of type <R>.
    • consume

      default void consume​(java.util.function.Consumer<T> consumer)

      Passes the arbitrary generated value to a Consumer<T>.

      Parameters:
      consumer - The Consumer<T> method that will make use of the generated value <T>.
    • consume

      default void consume​(int times, java.util.function.BiConsumer<java.lang.Integer,​T> biConsumer)

      Passes the arbitrary generated values to a BiConsumer<Integer, T> a number of times.

      Parameters:
      times - The number of times we are going to call the BiConsumer.
      biConsumer - The BiConsumer that is going to consume the arbitrary generated value(s). The first parameter of the BiConsumer represents the step.
    • valStr

      default java.lang.String valStr()

      Before retrieving the generated value, this method calls Object.toString() on <T>.

      If the generated value is null an empty string ("") is returned instead of throwing NullPointerException

      Returns:
      The string representation of the generated value.
    • valStr

      default java.lang.String valStr​(java.lang.String valueIfNull)

      The method is calling Object.toString() of the generated value.

      If the generated value is null returns the valueIfNull parameter instead.

      Parameters:
      valueIfNull - The default value to be returned if the generated value is null.
      Returns:
      The string representation of the generated value.
    • map

      default <R> MockUnit<R> map​(java.util.function.Function<T,​R> function)

      This method can be used in order to add intermediary processing before generating the value <T>.

      Type Parameters:
      R - The type of the newly returned MockUnit<R>.
      Parameters:
      function - The Function<T,R> applied to the generated value in the intermediary step. <T> and <R> can be the same type.
      Returns:
      A new MockUnit
    • mapToInt

      default MockUnitInt mapToInt​(java.util.function.ToIntFunction<T> function)

      This method is used to transform a MockUnit into a MockUnitInt.

      MockUnitInt is a super-type of MockUnit specialized in manipulating Integers.

      Parameters:
      function - The Function<T,Integer> applied to the generated value in the intermediary step.
      Returns:
      A new MockUnitInt.
    • mapToDouble

      default MockUnitDouble mapToDouble​(java.util.function.ToDoubleFunction<T> function)

      This method is used to transform a MockUnit into a MockUnitDouble.

      MockUnitDouble is a super-type of MockUnit specialized in manipulating Doubles.

      Parameters:
      function - The Function<T,Double> applied to the generated value in the intermediary step.
      Returns:
      A new MockUnitDouble
    • mapToLong

      default MockUnitLong mapToLong​(java.util.function.ToLongFunction<T> function)

      This method is used to transform a MockUnit into a MockUnitLong.

      MockUnitLong is a super-type of MockUnit specialized in manipulating Longs.

      Parameters:
      function - The Function<T,Long> applied to the generated value in the intermediary step.
      Returns:
      A new MockUnitLong
    • mapToString

      default MockUnitString mapToString​(java.util.function.Function<T,​java.lang.String> function)

      This method is used to transform a MockUnit into a MockUnitString.

      MockUnitString is a super-type of MockUnit containing more useful methods for manipulating Strings.

      Parameters:
      function - The transformation method.
      Returns:
      A new MockUnitString
    • mapToString

      default MockUnitString mapToString()

      This method is used to transform a MockUnit into a MockUnitString by calling the Object.toString() method.

      MockUnitString is a super-type of MockUnit containing more useful methods for manipulating Strings.

      Returns:
      A new MockUnitString.
    • mapToLocalDate

      default MockUnitLocalDate mapToLocalDate​(java.util.function.Function<T,​java.time.LocalDate> dateTransformer)

      This method is used to transform a MockUnit into a MOckUnitLocaldate.

      Parameters:
      dateTransformer - The transformation Function<T, LocalDate>
      Returns:
      A new MockUnitLocalDate
    • stream

      default MockUnit<java.util.stream.Stream<T>> stream()

      Transforms a MockUnit<T> into a MockUnit<Stream<T>>.

      Returns:
      A MockUnit<Stream<T>>
    • list

      @Deprecated default MockUnit<java.util.List<T>> list​(java.lang.Class<? extends java.util.List> listClass, int size)
      Deprecated.
      use list(Supplier, int) instead.

      Transforms a MockUnit<T> into a MockUnit<List<T>>.

      This method can used to generate fixed-length Lists containing arbitrary data.

      Parameters:
      listClass - The type of List we are going to use as the internal implementation (Eg.: ArrayList.class)
      size - The size of the List
      Returns:
      A new MockUnit<List<T>>
    • list

      default MockUnit<java.util.List<T>> list​(java.util.function.Supplier<java.util.List<T>> listSupplier, int size)

      Transforms a MockUnit<T> into a MockUnit<List<T>>.

      Note: The listSupplier should not return NULL values. Otherwise a NullPointer exception is thrown.

      Parameters:
      listSupplier - The supplier that returns a List<T>
      size - The final size of the list.
      Returns:
      A new MockUnit<List<T>>.
    • list

      @Deprecated default MockUnit<java.util.List<T>> list​(java.lang.Class<? extends java.util.List> listClass, MockUnitInt sizeUnit)
      Deprecated.

      Transforms a MockUnit<T> into a MockUnit<List<T>>.

      This method can used to generate variable-length Lists containing arbitrary data.

      Parameters:
      listClass - The type of List we are going to use as the internal implementation (Eg.: ArrayList.class)
      sizeUnit - The MockUnitInt used to generate the size of the List. If the MockUnitInt generates a negative value an exception will be thrown.
      Returns:
      A new MockUnit<List<T>>
    • list

      default MockUnit<java.util.List<T>> list​(java.util.function.Supplier<java.util.List<T>> listSupplier, MockUnitInt sizeUnit)

      Transforms a MockUnit<T> into a MockUnit<List<T>>.

      Note: The listSupplier should not return NULL values. Otherwise a NullPointer exception is thrown.

      Parameters:
      listSupplier - The supplier that returns a List<T>
      sizeUnit - The MockUnitInt used to generate the size of the List. If the MockUnitInt generates a negative value an exception will be thrown.
      Returns:
      A new MockUnit<List<T>>
    • list

      default MockUnit<java.util.List<T>> list​(int size)

      Transforms a MockUnit<T> into a MockUnit<List<T>>.

      This method can used to generate fixed-length Lists containing arbitrary data.

      NoteThe internal List implementation will be an ArrayList.

      Parameters:
      size - The size of the list.
      Returns:
      A new MockUnit<List<T>>
    • list

      default MockUnit<java.util.List<T>> list​(MockUnitInt sizeUnit)

      Transforms a MockUnit<T> into a MockUnit<List<T>>.

      This method can used to generate variable-length Lists containing arbitrary data.

      Note: The internal List implementation will be ArrayList.

      Parameters:
      sizeUnit - The MockUnitInt used to generate the size of the List. If the MockUnitInt generates a negative value an exception will be thrown.
      Returns:
      A new MockUnit<List<T>>
    • set

      @Deprecated default MockUnit<java.util.Set<T>> set​(java.lang.Class<? extends java.util.Set> setClass, int size)
      Deprecated.
      since 0.4.2 use set(Supplier, int) instead

      Transforms a MockUnit<T> into a MockUnit<Set<T>>.

      This method can be used to generate a fixed-length Set containing arbitrary data.

      Note: The size represents the max size of the Set, but it's not guaranteed to be so, given the nature of the Set (it doesn't accept duplicates).

      Note: If you are using a TreeSet.class as the implementing class you need to take in consideration it doesn't accept null values.

      Note: The implementing set need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Parameters:
      setClass - The Set<T> implementation we are going to use.
      size - The max size of the Set.
      Returns:
      A new MockUnit<Set<T>>
    • set

      default MockUnit<java.util.Set<T>> set​(java.util.function.Supplier<java.util.Set<T>> setSupplier, int size)

      Transforms a MockUnit<T> into a MockUnit<Set<T>>.

      This method can be used to generate a fixed-length Set containing arbitrary data.

      Note: The setSupplier should not return NULL values. Otherwise a NullPointer exception is thrown.

      Note: The size represents the max size of the Set, but it's not guaranteed to be so, given the nature of the Set (it doesn't accept duplicates).

      Note: If you are using a TreeSet.class as the implementing class you need to take in consideration it doesn't accept null values.

      Note: The implementing set need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Parameters:
      setSupplier - The supplier that returns a Set<T>.
      size - The max size of the Set.
      Returns:
      A new MockUnit<Set<T>>
    • set

      @Deprecated default MockUnit<java.util.Set<T>> set​(java.lang.Class<? extends java.util.Set> setClass, MockUnitInt sizeUnit)
      Deprecated.

      Transforms a MockUnit<T> into a MockUnit<Set<T>>.

      This method can be used to generate a variable-length Set containing arbitrary data.

      Note: The size represents the max size of the Set, but it's not guaranteed to be so, given the nature of the Set (it doesn't accept duplicates).

      Note: If you are using a TreeSet as the implementing class you need to take in consideration it doesn't accept null values.

      Note: The implementing set need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Parameters:
      setClass - setSupplier The supplier that returns a Set<T>.
      sizeUnit - The MockUnitInt used to generate the size of the Set. If the MockUnitInt generates a negative value an exception will be thrown.
      Returns:
      A new MockUnit<Set<T>>
    • set

      default MockUnit<java.util.Set<T>> set​(java.util.function.Supplier<java.util.Set<T>> setSupplier, MockUnitInt sizeUnit)

      Transforms a MockUnit<T> into a MockUnit<Set<T>>.

      Note: The setSupplier should not return NULL values. Otherwise a NullPointer exception is thrown.

      This method can be used to generate a variable-length Set containing arbitrary data.

      Note: The size represents the max size of the Set, but it's not guaranteed to be so, given the nature of the Set (it doesn't accept duplicates).

      Note: If you are using a TreeSet as the implementing class you need to take in consideration it doesn't accept null values.

      Note: The implementing set need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Parameters:
      setSupplier - The Set<T> implementation we are going to use.
      sizeUnit - The MockUnitInt used to generate the size of the Set. If the MockUnitInt generates a negative value an exception will be thrown.
      Returns:
      A new MockUnit<Set<T>>
    • set

      default MockUnit<java.util.Set<T>> set​(int size)

      Transforms a MockUnit<T> into a MockUnit<Set<T>>.

      This method can be used to generate a fixed-length Set containing arbitrary data.

      Note: The size represents the max size of the Set, but it's not guaranteed to be so, given the nature of the Set (it doesn't accept duplicates).

      Note: The internal Set implementation is HashSet.

      Parameters:
      size - The max size of the Set
      Returns:
      A new MockUnit<Set<T>>
    • set

      default MockUnit<java.util.Set<T>> set​(MockUnitInt sizeUnit)

      Transforms a MockUnit<T> into a MockUnit<Set<T>>.

      This method can be used to generate a fixed-length Set containing arbitrary data.

      Note: The internal Set implementation is HashSet

      Note: The size represents the max size of the Set, but it's not guaranteed to be so, given the nature of the Set.

      Parameters:
      sizeUnit - The MockUnitInt used to generate the size of the Set. If the MockUnitInt generates a negative value an exception will be thrown.
      Returns:
      A new MockUnit<Set<T>>
    • collection

      @Deprecated default MockUnit<java.util.Collection<T>> collection​(java.lang.Class<? extends java.util.Collection> collectionClass, int size)
      Deprecated.

      Transforms a MockUnit<T> into a MockUnit<Collection<T>>.

      This method can be used to generate a fixed-length Collection containing arbitrary data.

      Note: The implementing collection need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Parameters:
      collectionClass - The Collection<T> implementation we are going to use.
      size - The size of the collection. (If the collection is a Set, this is guaranteed to be the max size, not the actual one).
      Returns:
      A new MockUnit<Collection<T>>
    • collection

      default MockUnit<java.util.Collection<T>> collection​(java.util.function.Supplier<java.util.Collection<T>> collectionSupplier, int size)

      Transforms a MockUnit<T> into a MockUnit<Collection<T>>.

      This method can be used to generate a fixed-length Collection containing arbitrary data.

      Note: The implementing collection need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Parameters:
      collectionSupplier - The Supplier<Collection<T>> we are going to use to obtain the Collection instance.
      size - The size of the collection. (If the collection is a Set, this is guaranteed to be the max size, not the actual one).
      Returns:
      A new MockUnit<Collection<T>>
    • collection

      @Deprecated default MockUnit<java.util.Collection<T>> collection​(java.lang.Class<? extends java.util.Collection> collectionClass, MockUnitInt sizeUnit)
      Deprecated.

      Transforms a MockUnit<T> into a MockUnit<Collection<T>>.

      This method can be used to generate a variable-length Collection containing arbitrary data.

      Note: The implementing collection need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Parameters:
      collectionClass - The Collection<T> implementation we are going to use.
      sizeUnit - The MockUnitInt used to generate the size of the Collection. If the MockUnitInt generates a negative value an exception will be thrown. (If the collection is a Set, this is guaranteed to be the max size, not the actual one).
      Returns:
      A new MockUnit<Collection<T>>
    • collection

      default MockUnit<java.util.Collection<T>> collection​(java.util.function.Supplier<java.util.Collection<T>> collectionSupplier, MockUnitInt sizeUnit)

      Transforms a MockUnit<T> into a MockUnit<Collection<T>>.

      This method can be used to generate a variable-length Collection containing arbitrary data.

      Note: The implementing collection need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Parameters:
      collectionSupplier - The Supplier<Collection<T>> we are going to use to obtain the Collection instance.
      sizeUnit - The MockUnitInt used to generate the size of the Collection. If the MockUnitInt generates a negative value an exception will be thrown. (If the collection is a Set, this is guaranteed to be the max size, not the actual one).
      Returns:
      A new MockUnit<Collection<T>>
    • collection

      default MockUnit<java.util.Collection<T>> collection​(int size)

      Transforms a MockUnit<T> into a MockUnit<Collection<T>>.

      This method can be used to generate a fixed-length Collection containing arbitrary data.

      Note: The implementing collection is ArrayList.class.

      Parameters:
      size - The size of the Collection. (If the collection is a Set, this guaranteed to be the max size, not the actual one).
      Returns:
      A new MockUnit<Collection<T>>
    • collection

      default MockUnit<java.util.Collection<T>> collection​(MockUnitInt sizeUnit)

      Transforms a MockUnit<T> into a MockUnit<Collection<T>>.

      This method can be used to generate a fixed-length Collection containing arbitrary data.

      Note: The implementing collection is ArrayList.class.

      Parameters:
      sizeUnit - The size of the Collection generated through a MockUnitInt.
      Returns:
      A new MockUnit<Collection<T>>
    • mapKeys

      @Deprecated default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(java.lang.Class<? extends java.util.Map> mapClass, int size, java.util.function.Supplier<R> keysSupplier)
      Deprecated.

      Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given Supplier<R>.

      This method can be used to generate a fixed-length Map containing arbitrary data.

      Note: The implementing Map need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Type Parameters:
      R - The type of the Keys.
      Parameters:
      mapClass - The implementing class for the Map (eg.: HashMap).
      size - The size of the Map.
      keysSupplier - The supplier of the keys.
      Returns:
      A new MockUnit<Map<R, T>>
    • mapKeys

      default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(java.util.function.Supplier<java.util.Map<R,​T>> mapSupplier, int size, java.util.function.Supplier<R> keySupplier)

      Transforms a MockUnit<T> into a MockUnit<Map<R,T> where the keys are generated from a given Supplier<R>.

      This method can be used to generate a fixed-length Map containing arbitrary data.

      Type Parameters:
      R - The type of the Keys.
      Parameters:
      mapSupplier - The Supplier<Map<R, T> used to instantiate the Map<R, T>.
      size - The size of the Map.
      keySupplier - The supplier of the keys.
      Returns:
      A new MockUnit<Map<R, T>>
    • mapKeys

      @Deprecated default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(java.lang.Class<? extends java.util.Map> mapClass, MockUnitInt sizeUnit, java.util.function.Supplier<R> keysSupplier)

      Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given Supplier<R>.

      This method can be used to generate a variable-length Map containing arbitrary data.

      Note: The implementing Map need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Type Parameters:
      R - The type of the keys.
      Parameters:
      mapClass - The implementing class for the Map (eg.: HashMap).
      sizeUnit - The MockUnitInt used to generate the size of the Map. If the MockUnitInt generates a negative value an exception will be thrown.
      keysSupplier - The supplier of the keys.
      Returns:
      A new MockUnit<Map<R, T>>
    • mapKeys

      default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(java.util.function.Supplier<java.util.Map<R,​T>> mapSupplier, MockUnitInt sizeUnit, java.util.function.Supplier<R> keySupplier)

      Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given Supplier<R>.

      This method can be used to generate a variable-length Map containing arbitrary data.

      Note: The implementing Map need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Type Parameters:
      R - The type of the keys.
      Parameters:
      mapSupplier - The Supplier<Map<R, T>> that is used to obtain a Map instance.
      sizeUnit - The MockUnitInt used to generate the size of the Map. If the MockUnitInt generates a negative value an exception will be thrown.
      keySupplier - The supplier of the keys.
      Returns:
      A new MockUnit<Map<R, T>>
    • mapKeys

      default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(int size, java.util.function.Supplier<R> keysSupplier)

      Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given Supplier<R>.

      This method can be used to generate a fixed-length Map containing arbitrary data.

      Note: The implementing Map is HashMap.

      Type Parameters:
      R - The type of the keys.
      Parameters:
      size - The size of the Map.
      keysSupplier - The supplier of the keys.
      Returns:
      A new MockUnit<Map<R, T>>
    • mapKeys

      default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(MockUnitInt sizeUnit, java.util.function.Supplier<R> keysSupplier)

      Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given Supplier<R>.

      This method can be used to generate a variable-length Map containing arbitrary data.

      Note: The implementing Map is HashMap.

      Type Parameters:
      R - The type of the keys.
      Parameters:
      sizeUnit - The MockUnitInt used to generate the size of the Map. If the MockUnitInt generates a negative value an exception will be thrown.
      keysSupplier - The supplier of the keys.
      Returns:
      A new MockUnit<Map<R, T>>
    • mapKeys

      @Deprecated default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(java.lang.Class<? extends java.util.Map> mapClass, java.lang.Iterable<R> keys)
      Deprecated.

      Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given Iterable<R>.

      The size of the Map is determined by the supplied Iterable<R>.

      Note: The implementing Map need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Type Parameters:
      R - The type of the keys.
      Parameters:
      mapClass - The implementing class for the Map (eg.: HashMap.class).
      keys - The Iterable<R> used to generate the keys.
      Returns:
      A new MockUnit<Map<R, T>>
    • mapKeys

      default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(java.util.function.Supplier<java.util.Map<R,​T>> mapSupplier, java.lang.Iterable<R> keys)

      Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given Iterable<R>.

      The size of the Map is determined by the supplied Iterable<R>.

      Type Parameters:
      R - The type of the keys.
      Parameters:
      mapSupplier - A supplier method returning a Map<R, T>.
      keys - The Iterable<R> used to generate the keys.
      Returns:
      A new MockUnit<Map<R, T>>
    • mapKeys

      default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(java.lang.Iterable<R> keys)

      Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given Iterable<R>.

      The size of the Map is determined by the supplied Iterable<R>.

      Note: The implementing Map is HashMap.

      Type Parameters:
      R - The type of the keys.
      Parameters:
      keys - The Iterable<R> used to generate the keys.
      Returns:
      A new MockUnit<Map<R, T>>
    • mapKeys

      @Deprecated default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(java.lang.Class<? extends java.util.Map> mapClass, R[] keys)
      Deprecated.

      Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given Iterable<R>.

      The size of the Map is determined by the supplied Iterable<R>.

      Note: The implementing Map need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Type Parameters:
      R - The type of the keys.
      Parameters:
      mapClass - The implementing class of the collection (eg.: LinkedList).
      keys - The Iterable<R> used to generate the keys.
      Returns:
      A new MockUnit<Map<R, T>>
    • mapKeys

      default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(java.util.function.Supplier<java.util.Map<R,​T>> mapSupplier, R[] keys)

      Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given Iterable<R>.

      The size of the Map is determined by the supplied Iterable<R>.

      Type Parameters:
      R - The type of the keys.
      Parameters:
      mapSupplier - The supplier method returning a Map<R,T>.
      keys - The Iterable<R> used to generate the keys.
      Returns:
      A new MockUnit<Map<R, T>>
    • mapKeys

      default <R> MockUnit<java.util.Map<R,​T>> mapKeys​(R[] keys)

      Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given array.

      The size of the Map is determined by the supplied array.

      Note: The map type is HashMap.

      Type Parameters:
      R - The type of the keys.
      Parameters:
      keys - The array used to generate the keys.
      Returns:
      A new MockUnit<Map<R, T>>
    • mapKeys

      @Deprecated default MockUnit<java.util.Map<java.lang.Integer,​T>> mapKeys​(java.lang.Class<? extends java.util.Map> mapClass, int[] keys)
      Deprecated.

      Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given array.

      The size of the Map is determined by the supplied array.

      Note: The implementing Map need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Parameters:
      mapClass - The type of the Map (eg.: HashMap.class).
      keys - The array used to generate the keys.
      Returns:
      A new MockUnit<Map<R, T>>
    • mapKeys

      default MockUnit<java.util.Map<java.lang.Integer,​T>> mapKeys​(java.util.function.Supplier<java.util.Map<java.lang.Integer,​T>> mapSupplier, int[] keys)

      Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given array.

      The size of the Map is determined by the supplied array.

      Parameters:
      mapSupplier - The supplier method that returns a Map<Integer, T>.
      keys - The array used to generate the keys.
      Returns:
      A new MockUnit<Map<R, T>>
    • mapKeys

      default MockUnit<java.util.Map<java.lang.Integer,​T>> mapKeys​(int[] keys)

      Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given array.

      The size of the Map is determined by the supplied array.

      Note: The implementing Map is HashMap.

      Parameters:
      keys - The array used to generate the keys.
      Returns:
      A new MockUnit<Map<R, T>>
    • mapKeys

      @Deprecated default MockUnit<java.util.Map<java.lang.Long,​T>> mapKeys​(java.lang.Class<? extends java.util.Map> mapClass, long[] keys)
      Deprecated.

      Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given array.

      The size of the Map is determined by the supplied array.

      Note: The implementing Map need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Parameters:
      mapClass - The type of the Map (eg.: HashMap.class).
      keys - The array used to generate the keys.
      Returns:
      A new MockUnit<Map<R, T>>
    • mapKeys

      default MockUnit<java.util.Map<java.lang.Long,​T>> mapKeys​(java.util.function.Supplier<java.util.Map<java.lang.Long,​T>> mapSupplier, long[] keys)

      Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given array.

      The size of the Map is determined by the supplied array.

      Note: The implementing Map need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Parameters:
      mapSupplier - The supplier method that returns a Map<Long, T>.
      keys - The array used to generate the keys.
      Returns:
      A new MockUnit<Map<R, T>>
    • mapKeys

      default MockUnit<java.util.Map<java.lang.Long,​T>> mapKeys​(long[] keys)

      Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given array.

      The size of the Map is determined by the supplied array.

      Note: The implementing Map is HashMap.

      Parameters:
      keys - The array used to generate the keys.
      Returns:
      A new MockUnit<Map<R, T>>
    • mapKeys

      @Deprecated default MockUnit<java.util.Map<java.lang.Double,​T>> mapKeys​(java.lang.Class<? extends java.util.Map> mapClass, double[] keys)
      Deprecated.

      Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given array.

      The size of the Map is determined by the supplied array.

      Note: The implementing Map need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Parameters:
      mapClass - The type of the Map (eg.: HashMap.class).
      keys - The array used to generate the keys.
      Returns:
      A new MockUnit<Map<R, T>>
    • mapKeys

      default MockUnit<java.util.Map<java.lang.Double,​T>> mapKeys​(java.util.function.Supplier<java.util.Map<java.lang.Double,​T>> mapSupplier, double[] keys)

      Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given array.

      The size of the Map is determined by the supplied array.

      Parameters:
      mapSupplier - The supplier method that returns a Map<Double, T>.
      keys - The array used to generate the keys.
      Returns:
      A new MockUnit<Map<R, T>>
    • mapKeys

      default MockUnit<java.util.Map<java.lang.Double,​T>> mapKeys​(double[] keys)

      Transforms a MockUnit<T> into a MockUnit<Map<R,T>> where the keys are generated from a given array.

      The size of the Map is determined by the supplied array.

      Note: The implementing Map is HashMap.

      Parameters:
      keys - The array used to generate the keys.
      Returns:
      A new MockUnit<Map<R, T>>
    • mapVals

      @Deprecated default <R> MockUnit<java.util.Map<T,​R>> mapVals​(java.lang.Class<? extends java.util.Map> mapClass, int size, java.util.function.Supplier<R> valuesSupplier)
      Deprecated.

      Transforms a MockUnit<T> into a MockUnit<T,R> where the values generated from a Supplier<R>.

      This method can be used to generate a variable-length Map containing arbitrary data.

      Note: The implementing Map need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Type Parameters:
      R - The type of the values.
      Parameters:
      mapClass - The type of the Map (eg.: HashMap.class).
      size - The size of the map.
      valuesSupplier - The supplier of the values.
      Returns:
      A new MockUnit<Map<T, R>>
    • mapVals

      default <R> MockUnit<java.util.Map<T,​R>> mapVals​(java.util.function.Supplier<java.util.Map<T,​R>> mapSupplier, int size, java.util.function.Supplier<R> valuesSupplier)

      Transforms a MockUnit<T> into a MockUnit<T,R> where the values generated from a Supplier<R>.

      This method can be used to generate a variable-length Map containing arbitrary data.

      Note: The implementing Map need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Type Parameters:
      R - The type of the values.
      Parameters:
      mapSupplier - The supplier method that returns a Map<T, R>.
      size - The size of the map.
      valuesSupplier - The supplier of the values.
      Returns:
      A new MockUnit<Map<T, R>>
    • mapVals

      @Deprecated default <R> MockUnit<java.util.Map<T,​R>> mapVals​(java.lang.Class<? extends java.util.Map> mapClass, MockUnitInt sizeUnit, java.util.function.Supplier<R> valuesSupplier)

      Transforms a MockUnit<T> into a MockUnit<T,R> where the values generated from a Supplier<R>.

      This method can be used to generate a variable-length Map containing arbitrary data.

      Note: The implementing Map need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Type Parameters:
      R - The type the values.
      Parameters:
      mapClass - The type of the Map (eg.: HashMap.class).
      sizeUnit - The MockUnitInt used to generate the size of the Map. If the MockUnitInt generates a negative value an exception will be thrown.
      valuesSupplier - The supplier of the values.
      Returns:
      A new MockUnit<Map<T, R>>
    • mapVals

      default <R> MockUnit<java.util.Map<T,​R>> mapVals​(java.util.function.Supplier<java.util.Map<T,​R>> mapSupplier, MockUnitInt sizeUnit, java.util.function.Supplier<R> valuesSupplier)

      Transforms a MockUnit<T> into a MockUnit<T,R> where the values generated from a Supplier<R>.

      This method can be used to generate a variable-length Map containing arbitrary data.

      Type Parameters:
      R - The type the values.
      Parameters:
      mapSupplier - The supplier method that returns Map<T, R>.
      sizeUnit - The MockUnitInt used to generate the size of the Map. If the MockUnitInt generates a negative value an exception will be thrown.
      valuesSupplier - The supplier of the values.
      Returns:
      A new MockUnit<Map<T, R>>
    • mapVals

      default <R> MockUnit<java.util.Map<T,​R>> mapVals​(int size, java.util.function.Supplier<R> valuesSupplier)

      Transforms a MockUnit<T> into a MockUnit<T,R> where the values generated from a Supplier<R>.

      This method can be used to generate a fixed-length Map containing arbitrary data.

      Note: The implementing Map is HashMap.

      Type Parameters:
      R - The type the values.
      Parameters:
      size - The size of the map.
      valuesSupplier - The supplier of the values.
      Returns:
      A new MockUnit<Map<T, R>>
    • mapVals

      default <R> MockUnit<java.util.Map<T,​R>> mapVals​(MockUnitInt sizeUnit, java.util.function.Supplier<R> valuesSupplier)

      Transforms a MockUnit<T> into a MockUnit<T,R> where the values generated from a Supplier<R>.

      This method can be used to generate a variable-length Map containing arbitrary data.

      Note: The implementing Map is HashMap.

      Type Parameters:
      R - The type the values.
      Parameters:
      sizeUnit - The MockUnitInt used to generate the size of the Map. If the MockUnitInt generates a negative value an exception will be thrown.
      valuesSupplier - The supplier of the values.
      Returns:
      A new MockUnit<Map<T, R>>
    • mapVals

      @Deprecated default <R> MockUnit<java.util.Map<T,​R>> mapVals​(java.lang.Class<? extends java.util.Map> mapClass, java.lang.Iterable<R> values)
      Deprecated.

      Transforms a MockUnit<T> into a MockUnit<T,R> where the values generated from a Iterable<R>.

      The size of the Map is strictly determined by the size of the Iterable<R>.

      Note: The implementing Map need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Type Parameters:
      R - The type the values.
      Parameters:
      mapClass - The implementing class for the Map (eg.: HashMap.class).
      values - The Iterable<R> from where the values are selected in order.
      Returns:
      A new MockUnit<Map<T, R>>
    • mapVals

      default <R> MockUnit<java.util.Map<T,​R>> mapVals​(java.util.function.Supplier<java.util.Map<T,​R>> mapSupplier, java.lang.Iterable<R> values)

      Transforms a MockUnit<T> into a MockUnit<T,R> where the values generated from a Iterable<R>.

      The size of the Map is strictly determined by the size of the Iterable<R>.

      Type Parameters:
      R - The type the values.
      Parameters:
      mapSupplier - The supplier returning the Map<T, R> that will hold the values.
      values - The Iterable<R> from where the values are selected in order.
      Returns:
      A new MockUnit<Map<T, R>>
    • mapVals

      default <R> MockUnit<java.util.Map<T,​R>> mapVals​(java.lang.Iterable<R> values)

      Transforms a MockUnit<T> into a MockUnit<T,R> where the values are generated from a Iterable<R>.

      The size of the map is strictly determined by the size of the Iterable<R>.

      Note: The implementing map used is HashMap.

      Type Parameters:
      R - The type the values.
      Parameters:
      values - The Iterable<R> from where the values are selected in order.
      Returns:
      A new MockUnit<T,R>>
    • mapVals

      @Deprecated default <R> MockUnit<java.util.Map<T,​R>> mapVals​(java.lang.Class<? extends java.util.Map> mapClass, R[] values)
      Deprecated.

      Transforms a MockUnit<T> into a MockUnit<T,R> where the values are generated from an array.

      The size of the map is strictly determined by the size of the array.

      Note: The implementing Map need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Type Parameters:
      R - The type the values.
      Parameters:
      mapClass - The implementing class for the Map (eg.: HashMap.class).
      values - The array.
      Returns:
      A new MockUnit<Map<T, R>>
    • mapVals

      default <R> MockUnit<java.util.Map<T,​R>> mapVals​(java.util.function.Supplier<java.util.Map<T,​R>> mapSupplier, R[] values)

      Transforms a MockUnit<T> into a MockUnit<T,R> where the values are generated from an array.

      The size of the map is strictly determined by the size of the array.

      Note: The implementing Map need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Type Parameters:
      R - The type the values.
      Parameters:
      mapSupplier - The supplier method that returns the Map<T, R>.
      values - The array.
      Returns:
      A new MockUnit<Map<T, R>>
    • mapVals

      default <R> MockUnit<java.util.Map<T,​R>> mapVals​(R[] values)

      Transforms a MockUnit<T> into a MockUnit<T,R> where the values are generated from an array.

      The size of the map is strictly determined by the size of the array.

      Note: The implementing map used is HashMap.

      Type Parameters:
      R - The type the values.
      Parameters:
      values - The array.
      Returns:
      A new MockUnit<Map<T, R>>
    • mapVals

      @Deprecated default MockUnit<java.util.Map<T,​java.lang.Integer>> mapVals​(java.lang.Class<? extends java.util.Map> mapClass, int[] values)
      Deprecated.

      Transforms a MockUnit<T> into a MockUnit<T,R> where the values are generated from an array.

      The size of the map is strictly determined by the size of the array.

      Note: The implementing Map need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Parameters:
      mapClass - The implementing class for the Map (eg.: HashMap.class).
      values - The array.
      Returns:
      A new MockUnit<Map<T, R>>
    • mapVals

      default MockUnit<java.util.Map<T,​java.lang.Integer>> mapVals​(java.util.function.Supplier<java.util.Map<T,​java.lang.Integer>> mapSupplier, int[] values)

      Transforms a MockUnit<T> into a MockUnit<T,Integer> where the values are generated from an array.

      The size of the map is strictly determined by the size of the array.

      Parameters:
      mapSupplier - The supplier method that returns a Map<T, Integer>.
      values - The array.
      Returns:
      A new MockUnit<Map<T, R>>
    • mapVals

      default MockUnit<java.util.Map<T,​java.lang.Integer>> mapVals​(int[] values)

      Transforms a MockUnit<T> into a MockUnit<T,Integer> where the values are generated from an array.

      The size of the map is strictly determined by the size of the array.

      Note: The implementing map used is HashMap.

      Parameters:
      values - The array.
      Returns:
      A new MockUnit<Map<T, R>>
    • mapVals

      @Deprecated default MockUnit<java.util.Map<T,​java.lang.Long>> mapVals​(java.lang.Class<? extends java.util.Map> mapClass, long[] values)
      Deprecated.

      Transforms a MockUnit<T> into a MockUnit<T,Long> where the values are generated from an array.

      The size of the map is strictly determined by the size of the array.

      Note: The implementing Map need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Parameters:
      mapClass - The implementing class for the Map (eg.: HashMap.class).
      values - The array.
      Returns:
      A new MockUnit<Map<T, R>>
    • mapVals

      default MockUnit<java.util.Map<T,​java.lang.Long>> mapVals​(java.util.function.Supplier<java.util.Map<T,​java.lang.Long>> mapSupplier, long[] values)

      Transforms a MockUnit<T> into a MockUnit<T,Long> where the values are generated from an array.

      The size of the map is strictly determined by the size of the array.

      Parameters:
      mapSupplier - The supplier method that returns a Map<T, Long>.
      values - The array.
      Returns:
      A new MockUnit<Map<T, R>>
    • mapVals

      default MockUnit<java.util.Map<T,​java.lang.Long>> mapVals​(long[] values)

      Transforms a MockUnit<T> into a MockUnit<T,R> where the values are generated from an array.

      The size of the map is strictly determined by the size of the array.

      Note: The implementing map used is HashMap.

      Parameters:
      values - The array.
      Returns:
      A new MockUnit<Map<T, R>>.
    • mapVals

      @Deprecated default MockUnit<java.util.Map<T,​java.lang.Double>> mapVals​(java.lang.Class<? extends java.util.Map> mapClass, double[] values)
      Deprecated.

      Transforms a MockUnit<T> into a MockUnit<T,Double> where the values are generated from an array.

      The size of the map is strictly determined by the size of the array.

      Note: The implementing Map need to have a NON-ARG constructor, otherwise it won't be instantiated.

      Parameters:
      mapClass - The implementing class for the Map (eg.: HashMap.class).
      values - The array.
      Returns:
      A new MockUnit<Map<T, R>>
    • mapVals

      default MockUnit<java.util.Map<T,​java.lang.Double>> mapVals​(java.util.function.Supplier<java.util.Map<T,​java.lang.Double>> mapSupplier, double[] values)

      Transforms a MockUnit<T> into a MockUnit<T,Double> where the values are generated from an array.

      The size of the map is strictly determined by the size of the array.

      Parameters:
      mapSupplier - The supplier method that returns a Map<T, Double>.
      values - The array.
      Returns:
      A new MockUnit<Map<T, R>>
    • mapVals

      default MockUnit<java.util.Map<T,​java.lang.Double>> mapVals​(double[] values)

      Transforms a MockUnit<T> into a MockUnit<T,R> where the values are generated from an array.

      The size of the map is strictly determined by the size of the array.

      Note: The implementing map used is HashMap.

      Parameters:
      values - The array.
      Returns:
      A new MockUnit<Map<T, R>>
    • array

      default MockUnit<T[]> array​(java.lang.Class<T> cls, int size)

      Transforms a MockUnit<T> into a MockUnit<T[]>.

      Parameters:
      cls - The type of the value generated by the MockUnit (eg. Student.class)
      size - The size of the array.
      Returns:
      A new MockUnit<T[]>.
    • array

      default MockUnit<T[]> array​(java.util.function.Supplier<T[]> arraySupplier)

      Transforms a MockUnit<T> into a MockUnit<T[]>.

      Parameters:
      arraySupplier - The supplier method for the T[] array. The array size will be used.
      Returns:
      A new MockUnit<T[]>.