LongRangeUtil { public static long requireInRange(long val, long first, long lastExclusive) { if (val < first || val >= lastExclusive) { throw new IllegalArgumentException(val + IS_NOT_IN_THE_RANGE + first + ", " + lastExclusive + ")"); } return val; } private  LongRangeUtil(); static long requirePositive(long val); static long requireNegative(long val); static long requireZero(long val); static long requireNonPositive(long val); static long requireNonNegative(long val); static long requireNonZero(long val); static long requireEquals(long val, long otherVal); static long requireNotEquals(long val, long otherVal); static long requireInRange(long val, long first, long lastExclusive); static long requireInRangeClosed(long val, long first, long lastInclusive); static long requirePositive(long val, Function<String, E> exceptionConstructor); static long requireNegative(long val, Function<String, E> exceptionConstructor); static long requireZero(long val, Function<String, E> exceptionConstructor); static long requireNonPositive(long val, Function<String, E> exceptionConstructor); static long requireNonNegative(long val, Function<String, E> exceptionConstructor); static long requireNonZero(long val, Function<String, E> exceptionConstructor); static long requireEquals(long val, long otherVal, Function<String, E> exceptionConstructor); static long requireNotEquals(long val, long otherVal, Function<String, E> exceptionConstructor); static long requireInRange(long val, long first, long lastExclusive, Function<String, E> exceptionConstructor); static long requireInRangeClosed(long val, long first, long lastInclusive, Function<String, E> exceptionConstructor);  }
@Test void RequireInRange() { final long first = -1; final long lastExclusive = 4; testHelper(l -> l >= first && l < lastExclusive, l -> LongRangeUtil.requireInRange(l, first, lastExclusive)); }
@Test void testRequireInRange() { assertEquals(0.0, LongRangeUtil.requireInRange(0, -1,1, RuntimeException::new)); }
@Test void testRequireInRange2() { assertThrows(RuntimeException.class, () -> LongRangeUtil.requireInRange(-1,0,1, RuntimeException::new)); }
@Test void testRequireInRange3() { assertThrows(RuntimeException.class, () -> LongRangeUtil.requireInRange(1,-1,0, RuntimeException::new)); }
@Test void testRequireInRange4() { assertThrows(RuntimeException.class, () -> LongRangeUtil.requireInRange(0,-1,0, RuntimeException::new)); }