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
  • Constructor Details

  • Method Details

    • ints

      public static Ints ints()

      Returns a Ints object that can be used to generate arbitrary Integer numbers.

      Internally the method uses the Random::nextInt implementation.

      Returns:
      A re-usable Ints object. The Ints class implements MockUnitInt.
    • supplier

      public java.util.function.Supplier<java.lang.Integer> 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.Integer>
      Returns:
      A Supplier<T>.
    • bound

      public MockUnitInt bound​(java.lang.Integer 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

      public MockUnitInt upperBound​(int 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

      public MockUnitInt lowerBound​(int 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

      public MockUnitInt range​(java.lang.Integer lowerBound, java.lang.Integer upperBound)

      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

      public MockUnitInt rangeClosed​(int lowerBound, int upperBound)

      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

      public MockUnitInt from​(int[] alphabet)

      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.