public void validate() {
        checkNotNull(date, "date cannot be null");
        verifyYearMonthDayFormat(date);  //ensure YYYY-MM-DD

        checkState(eventCount >= 0, "eventCount must be non-negative");
        checkState(avgEventScore >= 0, "avgEventScore must be non-negative");

        //histogram must exist, have length N, all entries must be non-negative
        checkNotNull(histogram, "The histogram array cannot be null");
        checkState(histogram.length == NUM_HISTOGRAM_BINS, "The histogram must have " + NUM_HISTOGRAM_BINS + " entries");
        int sum = 0;
        for (int i : histogram) {
            checkState(i >= 0, "All histogram entries must be non-negative");
            sum += i;
        }
        checkState(eventCount == sum, "eventCount does not equal the sum of the histogram entries");
    }
@Test
    public void noargConstructorMakesInvalidObject() {
        DailyMetrics empty = new DailyMetrics();

        assertThrows(
            Exception.class,
            () -> empty.validate()
        );
    }