### Question:
Validate { public static <T extends Comparable<T>> T checkRange(T value, T begin, T end) { if (value.compareTo(begin) >= 0 && value.compareTo(end) <= 0) { return value; } throw new IllegalArgumentException("Value [" + value + "] out of range: [" + begin + ".." + end + "]"); } private  Validate(); static void isTrue(boolean expression); static void isTrue(boolean expression, String message); static T notNull(T object); static T notNull(T object, String message); static T checkRange(T value, T begin, T end);  }### Answer:
@Test public void shouldPassRangeCheck() { Validate.checkRange(10, 10, 20); Validate.checkRange(20, 10, 20); Validate.checkRange(15, 10, 20); }
@Test(expected = IllegalArgumentException.class) public void shouldFailIfValueIsOutsideTheLowerBound() { Validate.checkRange(9, 10, 20); }
@Test(expected = IllegalArgumentException.class) public void shouldFailIfValueIsOutsideTheUpperBound() { Validate.checkRange(21, 10, 20); }