public static String convertFreshnessToCron(IntervalFreshness intervalFreshness) {
        switch (intervalFreshness.getTimeUnit()) {
            case SECOND:
                return validateAndConvertCron(
                        intervalFreshness,
                        SECOND_CRON_UPPER_BOUND,
                        SECOND_CRON_EXPRESSION_TEMPLATE);
            case MINUTE:
                return validateAndConvertCron(
                        intervalFreshness,
                        MINUTE_CRON_UPPER_BOUND,
                        MINUTE_CRON_EXPRESSION_TEMPLATE);
            case HOUR:
                return validateAndConvertCron(
                        intervalFreshness, HOUR_CRON_UPPER_BOUND, HOUR_CRON_EXPRESSION_TEMPLATE);
            case DAY:
                return validateAndConvertDayCron(intervalFreshness);
            default:
                throw new ValidationException(
                        String.format(
                                "Unknown freshness time unit: %s.",
                                intervalFreshness.getTimeUnit()));
        }
    }
@Test
    void testConvertSecondFreshnessToCronExpression() {
        // verify illegal freshness
        assertThatThrownBy(() -> convertFreshnessToCron(IntervalFreshness.ofSecond("90")))
                .isInstanceOf(ValidationException.class)
                .hasMessageContaining(
                        "In full refresh mode, freshness must be less than 60 when the time unit is SECOND.");

        assertThatThrownBy(() -> convertFreshnessToCron(IntervalFreshness.ofSecond("32")))
                .isInstanceOf(ValidationException.class)
                .hasMessageContaining(
                        "In full refresh mode, only freshness that are factors of 60 are currently supported when the time unit is SECOND.");

        String actual1 = convertFreshnessToCron(IntervalFreshness.ofSecond("30"));
        assertThat(actual1).isEqualTo("0/30 * * * * ? *");

        String actual2 = convertFreshnessToCron(IntervalFreshness.ofSecond("5"));
        assertThat(actual2).isEqualTo("0/5 * * * * ? *");
    }