private Instant generateEvents(final Instant startTime,
                                   final Duration totalDuration,
                                   final Duration interval,
                                   final SQLStatisticAggregateMap statisticAggregateMap) {

        long iterations = totalDuration.dividedBy(interval);

        LongStream.rangeClosed(0, iterations)
                .boxed()
                .map(i -> startTime.minus(interval.multipliedBy(i)))
                .map(this::buildEvent)
                .forEach(event -> {
                    try {
                        statisticAggregateMap.addRolledUpEvent(event, 1000);
                    } catch (StatisticsEventValidationException e) {
                        throw new RuntimeException(e);
                    }
                });
        return startTime.minus(totalDuration);
    }
Useful for injecting stats into SQL_STAT_VAL_SRC, either to manually test aggregation
or to produce data to view in a dash
stroom-app/src/test/java/stroom/statistics/impl/sql/GenerateStatValSourceRows.java