Class Range<N extends Number & Comparable<N>>

java.lang.Object
org.junitpioneer.jupiter.params.Range<N>
Type Parameters:
N - The numerical type used by the range.
All Implemented Interfaces:
Iterator<N>
Direct Known Subclasses:
ByteRange, DoubleRange, FloatRange, IntRange, LongRange, ShortRange

abstract class Range<N extends Number & Comparable<N>> extends Object implements Iterator<N>
An iterator for numerical ranges, used as the backing logic for RangeSourceArgumentsProvider.
  • Field Details

  • Constructor Details

    • Range

      Range(N from, N to, N step, boolean closed, N zero)
  • Method Details

    • validate

      void validate()
      Asserts the range is valid.
      Throws:
      IllegalArgumentException - if the range is not valid
    • isValidDescending

      boolean isValidDescending()
    • getStep

      N getStep()
    • getCurrent

      N getCurrent()
    • nextValue

      abstract N nextValue()
      The next value in the range. Calling next() will return this value and advance the iterator to it.
    • getNextValue

      private N getNextValue()
    • getZero

      private N getZero()
      The value of the no-op "zero", illegal step in terms of N
    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<N extends Number & Comparable<N>>
    • next

      public N next()
      Specified by:
      next in interface Iterator<N extends Number & Comparable<N>>