Double calculateMedian(List<Double> durationEntries) {
        if (durationEntries.isEmpty()) {
            return 0.0;
        }
        Collections.sort(durationEntries);
        int middle = durationEntries.size() / 2;
        if (durationEntries.size() % 2 == 1) {
            return durationEntries.get(middle);
        } else {
            double total = durationEntries.get(middle - 1) + durationEntries.get(middle);
            return total / 2;
        }
    }
@Test
    void calculateMedianOfOddNumberOfEntries() {
        OutputStream out = new ByteArrayOutputStream();
        UsageFormatter usageFormatter = new UsageFormatter(out);
        Double result = usageFormatter
                .calculateMedian(asList(1.0, 2.0, 3.0));
        assertThat(result, is(closeTo(2.0, EPSILON)));
    }