- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 47
 
MockUnitDouble
Important Note: The library the documentation has moved to www.mockneat.com. The information found on this wiki is quite outdated. Please check the new site.
The MockUnitDouble interface extends MockUnit<Double>.
public interface `MockUnitDouble` extends MockUnit<Double>This means that it "inherits" all the methods from MockUnit<Double>
The easiest way to obtain a MockUnitDouble is to call the doubles() method from MockNeat or to call the mapToDouble() method.
Methods that are particular to MockUnitDouble:
| Method | Description | 
|---|---|
arrayPrimitive() | 
Generates a MockUnit<double[]> from a MockUnitDouble. | 
array() | 
Generates a MockUnit<Double[]> from a MockUnitDouble. | 
doubleStream() | 
Generates a MockUnit<DoubleStream> from a MockUnitDouble. | 
The method is used to generate a MockUnit<Double[]> from a MockUnitDouble.
Compared to the array() method from MockUnit<T> there's no reason to specify the type of the array. We know it's Double[].
Example for creating an array of 100 random Doubles, with values between [1000.0, 2000.0):
Double[] array = mock.doubles()
                      .range(1000.0, 2000.0)
                      .array(100)
                      .val();This method is used to generate a MockUnit<double[]> from a MockUnitDouble.
Example for creating a primitive array of 100 random doubles, with values between [1000.0, 2000.0):
double[] array = mock.doubles()
                     .range(1000, 200)
                     .arrayPrimitive(100)
                     .val();Can be used to obtain a more specific DoubleStream instead of a Stream<Double>, which normally can be obtain with the stream() from MockUnit<Double>.
Using the library:
Real World Examples: