NumberLibrary { public static int bounded(int min, int max, int target) { target = Math.max(min, target); target = Math.min(max, target); return target; }  static Function<String, Integer> methodParseInteger(); static int ifNegative(int number, int ifNegative); static int ifLessThan(int bound, int number, int ifLess); static int ifGreaterThan(int bound, int number, int ifGreater); static int bounded(int min, int max, int target); static int sumInts(Iterable<Integer> values); static long sumLongs(Iterable<Long> values); static double sum(Iterable<? extends Number> values); static double mean(Collection<? extends Number> values); static double median(Collection<? extends T> values);  }
@Test public void numberWithinBounds() { assertTrue(0 == bounded(0, 0, 0)); assertTrue(1 == bounded(1, 1, 1)); assertTrue(-1 == bounded(-1, -1, -1)); assertTrue(-1 == bounded(-1, 1, -1)); assertTrue(0 == bounded(-1, 1, 0)); assertTrue(1 == bounded(-1, 1, 1)); assertTrue(0 == bounded(0, 1, -1)); assertTrue(-1 == bounded(-1, 1, -2)); assertTrue(1 == bounded(0, 1, 2)); assertTrue(-1 == bounded(-3, -1, 0)); }