Class Seq<T>
- All Implemented Interfaces:
MockUnit<T>
public final class Seq<T> extends java.lang.Object implements MockUnit<T>
-
Method Summary
Modifier and Type Method Description Seq<T>after(T after)Ifcycle(boolean)is not enabled, the @param after is the default value generated by the sequence.Seq<T>afterDoMock(MockUnit<T> after)Ifcycle(boolean)is not enabled, this method is used to generate values after the sequence is exhausted.Seq<T>cycle(boolean value)Enables cycling through the elements if the finite source of elements is exhausted.static <T> Seq<T>fromArray(T[] array)Returns aSeq<T>object that can be used to generate values by iterating through all the elements of an array in order.static Seq<java.lang.String>fromDict(DictType dictType)Returns a newSeq<String>object that can be used to generate values by iterating through all the lines associated with aDictTypestatic <T> Seq<T>fromIterable(java.lang.Iterable<T> iterable)Returns a newSeq<T>object that can be used to generate values by iterating trough the givenIterable<T>in order.static <T> Seq<T>seq(java.lang.Iterable<T> iterable)Returns a newSeq<T>object that can be used to generate values by iterating trough the givenIterable<T>in order.static Seq<?>seq(DictType dictType)Returns a newSeq<String>object that can be used to generate values by iterating through all the lines associated with aDictTypestatic <T> Seq<T>seq(T[] array)Returns aSeq<T>object that can be used to generate values by iterating through all the elements of an array in order.java.util.function.Supplier<T>supplier()This is the sole abstract method of the interface.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.andreinc.mockneat.abstraction.MockUnit
array, array, collection, collection, collection, collection, collection, collection, consume, consume, get, get, list, list, list, list, list, list, map, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapToDouble, mapToInt, mapToLocalDate, mapToLong, mapToString, mapToString, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, serialize, set, set, set, set, set, set, stream, val, val, valStr, valStr
-
Method Details
-
seq
Returns a new
Seq<String>object that can be used to generate values by iterating through all the lines associated with aDictType- Parameters:
dictType- TheDictTypeto iterate over- Returns:
- A re-usable
Seq<String>. The class implementsMockUnitString
-
seq
Returns a new
Seq<T>object that can be used to generate values by iterating trough the givenIterable<T>in order.- Type Parameters:
T- The type of both the resultingSeq<T>and theIterable<T>- Parameters:
iterable- TheIterable<T>values.- Returns:
- A re-usable
Seq<T>object. The class implementsMockUnit<T>
-
seq
Returns a
Seq<T>object that can be used to generate values by iterating through all the elements of an array in order.- Type Parameters:
T- The type of the array- Parameters:
array- The array to iterate over- Returns:
- A re-usable
Seq<T>. The class implementMockUnit<T>
-
fromDict
Returns a new
Seq<String>object that can be used to generate values by iterating through all the lines associated with aDictType- Parameters:
dictType- TheDictTypeto iterate over- Returns:
- A re-usable
Seq<String>. The class implementsMockUnitString
-
fromIterable
Returns a new
Seq<T>object that can be used to generate values by iterating trough the givenIterable<T>in order.- Type Parameters:
T- The type of both the resultingSeq<T>and theIterable<T>- Parameters:
iterable- TheIterable<T>values.- Returns:
- A re-usable
Seq<T>object. The class implementsMockUnit<T>
-
fromArray
Returns a
Seq<T>object that can be used to generate values by iterating through all the elements of an array in order.- Type Parameters:
T- The type of the array- Parameters:
array- The array to iterate over- Returns:
- A re-usable
Seq<T>. The class implementMockUnit<T>
-
cycle
Enables cycling through the elements if the finite source of elements is exhausted.
For example if an array has 3 elements, and we create the sequence from it, after calling the
get()3 times, anullwill be retrieved.- Parameters:
value- By default it's false- Returns:
- The same
Seq<?>object.
-
after
If
cycle(boolean)is not enabled, the @param after is the default value generated by the sequence.- Parameters:
after- The default value after Sequence it's generated.- Returns:
- The same
Seq<T>object.
-
afterDoMock
If
cycle(boolean)is not enabled, this method is used to generate values after the sequence is exhausted.- Parameters:
after- TheMockUnit<T>to be used after the sequence is exhausted.- Returns:
- The same
Seq<T>object.
-
supplier
Description copied from interface:MockUnitThis is the sole abstract method of the interface. Needs to be implemented every-time a MockUnit is implemented.
-