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 calculateMedianOfEmptyList() {
        OutputStream out = new ByteArrayOutputStream();
        UsageFormatter usageFormatter = new UsageFormatter(out);
        Double result = usageFormatter.calculateMedian(Collections.emptyList());
        assertThat(result, is(equalTo(0.0)));
    }