### Question:
DefaultRandomValues implements RandomValues { @Override public long randomLong(final long lower, final long upper) { satisfies(lower <= upper, "the upper bound must be equal to or greater than the lower bound"); if (lower == upper) { return lower; } final long diff = upper - lower; if (diff >= 0 && diff != Integer.MAX_VALUE) { return (lower + randomLong(diff + 1)); } long i; do { i = random.nextLong(); } while (i < lower || i > upper); return i; } DefaultRandomValues(final Random random); @Override boolean randomBoolean(); @Override int randomInteger(final int lower, final int upper); @Override long randomLong(final long lower, final long upper); @Override double randomDouble(final double lower, final double upper); @Override double randomDouble(final double lower, final double upper, final int scale); @Override byte randomByte(final byte lower, final byte upper); @Override byte[] randomBytes(final int length); @Override short randomShort(final short lower, final short upper);  }### Answer:
@Test public void returnsSingleLongValueWhenLowerAndUpperBoundAreEqual() { assertThat(randomValues.randomLong(1, 1)) .isEqualTo(1); assertThat(randomValues.randomLong(0, 0)) .isEqualTo(0); assertThat(randomValues.randomLong(Long.MIN_VALUE, Long.MIN_VALUE)) .isEqualTo(Long.MIN_VALUE); assertThat(randomValues.randomLong(Long.MAX_VALUE, Long.MAX_VALUE)) .isEqualTo(Long.MAX_VALUE); }
@Test(expected = IllegalArgumentException.class) public void throwsAnExceptionWhenUpperBoundIsLessThanTheLowerBoundForRandomLong() { randomValues.randomLong(1, 0); }