Optional<TimeRange> parse(final String shortTimerange) {
        if (shortTimerange != null && SHORT_FORMAT_PATTERN.matcher(shortTimerange).matches()) {
            final String numberPart = shortTimerange.substring(0, shortTimerange.length() - 1);
            final String periodPart = shortTimerange.substring(shortTimerange.length() - 1);
            String longPeriodPart = SHORT_TO_LONG_PERIOD_MAPPING.get(periodPart);
            if (longPeriodPart != null) {
                if ("1".equals(numberPart)) {
                    longPeriodPart = longPeriodPart.substring(0, longPeriodPart.length() - 1); //removing last "s"
                }
                return Optional.of(
                        KeywordRange.create(
                                "last " + numberPart + " " + longPeriodPart,
                                "UTC")
                );
            }
        }
        return Optional.empty();
    }
@Test
    void returnsProperTimeRangeOnGoodInput() {
        assertThat(toTest.parse("12s"))
                .isPresent()
                .contains(KeywordRange.create("last 12 seconds", "UTC"));
        assertThat(toTest.parse("42m"))
                .isPresent()
                .contains(KeywordRange.create("last 42 minutes", "UTC"));
        assertThat(toTest.parse("1h"))
                .isPresent()
                .contains(KeywordRange.create("last 1 hour", "UTC"));
        assertThat(toTest.parse("1d"))
                .isPresent()
                .contains(KeywordRange.create("last 1 day", "UTC"));
        assertThat(toTest.parse("2w"))
                .isPresent()
                .contains(KeywordRange.create("last 2 weeks", "UTC"));
        assertThat(toTest.parse("3M"))
                .isPresent()
                .contains(KeywordRange.create("last 3 months", "UTC"));
        assertThat(toTest.parse("1000y"))
                .isPresent()
                .contains(KeywordRange.create("last 1000 years", "UTC"));
    }