NumberLibrary { public static long sumLongs(Iterable<Long> values) { long total = 0; for (Long value : values) { total += value; } return total; }  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 sumOfLongsOfACollection() { Collection<Long> empty = asList(); assertTrue(0 == sumLongs(empty)); assertTrue(10 == sumLongs(asList(1L,2L,3L,4L))); assertTrue(-10 == sumLongs(asList(-1L,-2L,-3L,-4L))); }