Class Longs

java.lang.Object
net.andreinc.mockneat.abstraction.MockUnitBase
net.andreinc.mockneat.unit.types.Longs
All Implemented Interfaces:
MockUnit<java.lang.Long>, MockUnitLong

public class Longs
extends MockUnitBase
implements MockUnitLong
  • Constructor Details

  • Method Details

    • longs

      public static Longs longs()

      Returns a Longs object that can be used to generate arbitrary Long numbers.

      Note:By default the internal Random.nextLong() will be called.

      Returns:
      A re-usable Longs object. The Longs class extends the MockUnitLong class.
    • supplier

      public java.util.function.Supplier<java.lang.Long> supplier()
      Description copied from interface: MockUnit
      This is the sole abstract method of the interface. Needs to be implemented every-time a MockUnit is implemented.
      Specified by:
      supplier in interface MockUnit<java.lang.Long>
      Returns:
      A Supplier<T>.
    • bound

      public MockUnitLong bound​(java.lang.Long bound)

      This method returns a MockUnitLong that can be used to generate arbitrary numbers in the [0, bound) interval.

      Parameters:
      bound - The interval's bound.
      Returns:
      A new MockUnitLong.
    • upperBound

      public MockUnitLong upperBound​(long upperBound)

      This method returns a MockUnitLong that can be used to generate arbitrary numbers in the [0, bound) interval.

      Parameters:
      upperBound - The interval's bound.
      Returns:
      A new MockUnitLong.
    • lowerBound

      public MockUnitLong lowerBound​(long lowerBound)

      This method can be used to generate arbitrary long value in [lowerBound, Long.MAX_VALUE]

      Parameters:
      lowerBound - The lower bound. Should be different than Long.MAX_VALUE and bigger than 0.
      Returns:
      A new MockUnitLong
    • range

      public MockUnitLong range​(java.lang.Long lowerBound, java.lang.Long upperBound)

      This method returns a MockUnitLong that can be used generate arbitrary numbers in the given range: [loweBound, upperBound)

      Parameters:
      lowerBound - The lower bound of the interval.
      upperBound - The upper bound of the interval.
      Returns:
      A new MockUnitLong.
    • rangeClosed

      public MockUnitLong rangeClosed​(long lowerBound, long upperBound)

      This method return a MockUnitLong that can be used to generate arbitrary numbers in the given closed range: [lowerBound, upperBound]

      Parameters:
      lowerBound - The lower bound of the interval.
      upperBound - The upper bound of the interval.
      Returns:
      A new MockUnitLong.
    • from

      public MockUnitLong from​(long[] alphabet)

      This method returns a MockUnitLong that can be used to generate arbitrary long numbers from the given alphabet.

      Parameters:
      alphabet - The alphabet from which the values are selected.
      Returns:
      A new MockUnitLong.