Double calculateAverage(List<Double> durationEntries) {
        double sum = 0.0;
        for (Double duration : durationEntries) {
            sum = sum + duration;
        }
        if (sum == 0) {
            return 0.0;
        }

        return sum / durationEntries.size();
    }
@Test
    void calculateAverageFromList() {
        OutputStream out = new ByteArrayOutputStream();
        UsageFormatter usageFormatter = new UsageFormatter(out);
        Double result = usageFormatter
                .calculateAverage(asList(1.0, 2.0, 3.0));
        assertThat(result, is(closeTo(2.0, EPSILON)));
    }