@SneakyThrows
  public static Optional<Date> nextExecutionDate(
      TimeTrigger trigger, Date startDate, String uniqueId) {
    CronTimeTrigger cronTimeTrigger = getCronTimeTrigger(trigger);
    if (cronTimeTrigger != null) {
      CronExpression cronExpression =
          TriggerHelper.buildCron(cronTimeTrigger.getCron(), cronTimeTrigger.getTimezone());
      Date nextTime = cronExpression.getNextValidTimeAfter(startDate);
      if (nextTime != null) {
        nextTime.setTime(
            nextTime.getTime()
                + getDelayInSeconds(cronTimeTrigger, uniqueId) * TimeTrigger.MS_IN_SECONDS);
      }
      return Optional.ofNullable(nextTime);
    }

    throw new UnsupportedOperationException(
        "TimeTrigger nextExecutionDate is not implemented for type: " + trigger.getType());
  }
@Test
  public void testNextExecutionDateForPredefined() throws Exception {
    TimeTrigger trigger =
        loadObject("fixtures/time_triggers/sample-predefined-time-trigger.json", TimeTrigger.class);
    Optional<Date> actual =
        TriggerHelper.nextExecutionDate(trigger, Date.from(Instant.EPOCH), "test-id");
    assertEquals(Optional.of(Date.from(Instant.ofEpochSecond(28800))), actual);
  }