public static Interval of(String interval, TimeRange timeRange) {
        switch (timeRange.type()) {
            case TimeRange.KEYWORD: return timestampInterval(interval);
            case TimeRange.ABSOLUTE:
                return ofAbsoluteRange(interval, (AbsoluteRange)timeRange);
            case TimeRange.RELATIVE:
                return ofRelativeRange(interval, (RelativeRange)timeRange);
        }

        throw new RuntimeException("Unable to parse time range type: " + timeRange.type());
    }
@Test
    public void returnsParsedIntervalIfRelativeRangeButBelowLimit() {
        final RelativeRange relativeRange = RelativeRange.create(450);

        final Interval interval = ApproximatedAutoIntervalFactory.of("minute", relativeRange);

        assertThat(interval).isEqualTo(TimeUnitInterval.create(TimeUnitInterval.IntervalUnit.MINUTES, 1));
    }