Package net.andreinc.mockneat.unit.types
Class Ints
java.lang.Object
net.andreinc.mockneat.abstraction.MockUnitBase
net.andreinc.mockneat.unit.types.Ints
- All Implemented Interfaces:
MockUnit<java.lang.Integer>,MockUnitInt
public class Ints extends MockUnitBase implements MockUnitInt
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description MockUnitIntbound(java.lang.Integer bound)This method can be used to generate arbitrary integer value in the [0, bound) range.MockUnitIntfrom(int[] alphabet)This method can be used to generate arbitrary integer values from the givenalphabet.static Intsints()Returns aIntsobject that can be used to generate arbitraryIntegernumbers.MockUnitIntlowerBound(int lowerBound)This method can be used to generate arbitrary integer value in [lowerBound, Integer.MAX_VALUE]MockUnitIntrange(java.lang.Integer lowerBound, java.lang.Integer upperBound)This method can be used to generate arbitrary integer values in the [lowerBound, upperBound) range.MockUnitIntrangeClosed(int lowerBound, int upperBound)This method can be used to generate arbitrary integer values in the [lowerBound, upperBound] range.java.util.function.Supplier<java.lang.Integer>supplier()This is the sole abstract method of the interface.MockUnitIntupperBound(int upperBound)This method can be used to generate arbitrary integer value in the [0, bound) range.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, valStrMethods inherited from interface net.andreinc.mockneat.abstraction.MockUnitInt
array, arrayPrimitive, intStream
-
Constructor Details
-
Method Details
-
ints
Returns a
Intsobject that can be used to generate arbitraryIntegernumbers.Internally the method uses the
Random::nextIntimplementation.- Returns:
- A re-usable
Intsobject. TheIntsclass implementsMockUnitInt.
-
supplier
public java.util.function.Supplier<java.lang.Integer> supplier()Description copied from interface:MockUnitThis is the sole abstract method of the interface. Needs to be implemented every-time a MockUnit is implemented. -
bound
This method can be used to generate arbitrary integer value in the [0, bound) range.
- Parameters:
bound- The interval bound.- Returns:
- A new
MockUnitInt.
-
upperBound
This method can be used to generate arbitrary integer value in the [0, bound) range.
- Parameters:
upperBound- The interval bound. Should be bigger than Zero.- Returns:
- A new
MockUnitInt.
-
lowerBound
This method can be used to generate arbitrary integer value in [lowerBound, Integer.MAX_VALUE]
- Parameters:
lowerBound- The lower bound. Should be different than Integer.MAX_VALUE and bigger than 0.- Returns:
- A new
MockUnitInt
-
range
This method can be used to generate arbitrary integer values in the [lowerBound, upperBound) range.
- Parameters:
lowerBound- The lower bound.upperBound- The upper bound.- Returns:
- A new
MockUnitInt.
-
rangeClosed
This method can be used to generate arbitrary integer values in the [lowerBound, upperBound] range.
- Parameters:
lowerBound- The lower bound.upperBound- The upper bound.- Returns:
- A new
MockUnitInt
-
from
This method can be used to generate arbitrary integer values from the given
alphabet.- Parameters:
alphabet- The alphabet from which the values are selected.- Returns:
- A new
MockUnitInt.
-