### Question:
ScheduleException extends IllegalArgumentException { public Optional<PeriodicSchedule> getDefinition() { return Optional.ofNullable(definition); } ScheduleException(String msgTemplate, Object... msgArguments);  ScheduleException(PeriodicSchedule definition, String msgTemplate, Object... msgArguments); Optional<PeriodicSchedule> getDefinition();  }### Answer:
@Test public void test_withDefinition() { PeriodicSchedule defn = PeriodicSchedule.of( date(2014, 6, 30), date(2014, 8, 30), Frequency.P1M, BusinessDayAdjustment.NONE, StubConvention.NONE, false); ScheduleException test = new ScheduleException(defn, "Hello {}", "World"); assertThat(test.getMessage()).isEqualTo("Hello World"); assertThat(test.getDefinition()).isEqualTo(Optional.of(defn)); }
@Test public void test_withoutDefinition() { ScheduleException test = new ScheduleException("Hello {}", "World"); assertThat(test.getMessage()).isEqualTo("Hello World"); assertThat(test.getDefinition()).isEqualTo(Optional.empty()); }