@VisibleForTesting
    static Duration parseToDuration(String timeStr) {
        final Matcher matcher = Pattern.compile("(?<value>\\d+)\\s*(?<time>[dhms])").matcher(timeStr);
        if (!matcher.matches()) {
            throw new IllegalArgumentException("Expected a time specification in the form <number>[d,h,m,s], e.g. 3m, but found [" + timeStr + "]");
        }
        final int value = Integer.parseInt(matcher.group("value"));
        final String timeSpecifier = matcher.group("time");
        final TemporalUnit unit;
        switch (timeSpecifier) {
            case "d": unit = ChronoUnit.DAYS; break;
            case "h": unit = ChronoUnit.HOURS; break;
            case "m": unit = ChronoUnit.MINUTES; break;
            case "s": unit = ChronoUnit.SECONDS; break;
            default: throw new IllegalStateException("Expected a time unit specification from d,h,m,s but found: [" + timeSpecifier + "]");
        }
        return Duration.of(value, unit);
    }
@Test(expected = IllegalArgumentException.class)
    public void testParseToDurationWithBadDurationFormatThrowsAnError() {
        AbstractPipelineExt.parseToDuration("+3m");
    }