-
-
Notifications
You must be signed in to change notification settings - Fork 47
MockUnitLong
The MockUnitLong
interface extends MockUnit<Long>
.
public interface MockUnitLong extends MockUnit<Long>
This means that it "inherits" all the methods from MockUnit<Long>
The easiest way to obtain a MockUnitInt
is to call the longs()
method from MockNeat
or to call the mapToLong()
method.
Methods that are particular to MockUnitLong
:
Method | Description |
---|---|
arrayPrimitive() |
Generates a MockUnit<long[]> from a MockUnitLong . |
array() |
Generates a MockUnit<Long[]> from a MockUnitLong . |
longStream() |
Generates a MockUnit<LongStream> from a MockUnitLong . |
The method is used to generate a MockUnit<Long[]>
from a MockUnitLong
.
Compared to the array()
method from MockUnit<T>
there's no reason to specify the type of the array. We know it's Long[]
.
Example for creating an array of 100 random Longs, with values between [1000, 2000):
Long[] array = mock.longs()
.range(1000l, 2000l)
.array(100)
.val();
This method is used to generate a MockUnit<long[]>
from a MockUnitLong
.
Example for creating a primitive array of 100 random longs, with values between [1000l, 2000l):
long[] array = mock.longs()
.range(1000, 200)
.arrayPrimitive(100)
.val();
Can be used to obtain a more specific LongStream
instead of a Stream<Long>
, which normally can be obtain with the stream()
from MockUnit<Long>
.
Using the library:
Real World Examples: