### Question:
RandomClosedRangeGenerator implements Generator<Range<T>> { @Override public Range<T> next() { T a = delegate.next(); T b = delegate.next(); T lower = Ordering.natural().min(a, b); T upper = Ordering.natural().max(a, b); return closed(lower, upper); } RandomClosedRangeGenerator(@Nonnull Generator<T> delegate); @Override Range<T> next();  }### Answer:
@Test public void shouldGenerateClosedRangeOfLongsWhenFirstGeneratedIsHigher() { given(generator.next()).willReturn(upper, lower); Range<Long> integerRange = randomRangeGenerator.next(); assertThat(integerRange, is(Range.closed(lower, upper))); }
@Test public void shouldGenerateClosedRangeOfLongsWhenFirstGeneratedIsLower() { given(generator.next()).willReturn(lower, upper); Range<Long> integerRange = randomRangeGenerator.next(); assertThat(integerRange, is(Range.closed(lower, upper))); }
@Test public void shouldGenerateClosedRangeOfLongsWhenFirstIsSameAsSecond() { given(generator.next()).willReturn(TEN, TEN); Range<Long> integerRange = randomRangeGenerator.next(); assertThat(integerRange, is(Range.singleton(TEN))); }