BenchmarkUtils { public static double avg(Iterable<Double> iterable) { Iterator<Double> iterator = iterable.iterator(); double total = 0.0; int num = 0; while (iterator.hasNext()) { total += iterator.next(); num++; } return total / num; } private  BenchmarkUtils(); static double max(Iterable<Double> iterable); static double avg(Iterable<Double> iterable); static void putIfAbsent(Map map, Object key, Object val); static int getInt(Map map, Object key, int def); static boolean ifAckEnabled(Config config);  }
@Test(dataProvider = "getAvgs") public void testAvg(Iterable<Double> numbers, double expected) { assertThat(BenchmarkUtils.avg(numbers)).isEqualTo(expected); }