@Test public void builderShouldBuildConfigurationWhenRequiredFieldsAreProvided() { SchedulingConfiguration configuration = SchedulingConfiguration.builder() .time(LocalTime.parse("13:23")) .recurrence(ArchiveRecurrence.daily()) .build(); assertThat(configuration.getRepeatKind()).isEqualTo(RepeatKind.DAILY); assertThat(configuration.getHour()).isEqualTo(13); assertThat(configuration.getMinute()).isEqualTo(23); }
private static LocalTime parseTime(String value) { return LocalTime.parse(value); }
@Test(expected = IllegalStateException.class) public void builderShouldThrowWhenRepeatKindIsNotProvided() { SchedulingConfiguration.builder().time(LocalTime.parse("10:22")).build(); }
@Test(expected = IllegalArgumentException.class) public void builderShouldThrowWhenTimeHasMillis() { SchedulingConfiguration.builder().time(LocalTime.parse("12:22:00.552")).build(); }
public static Time parseTime(String text) { return new Time(LocalTime.parse(text)); }
public void setDeparture(String departure) { this.sessionContext.setDeparture( StringUtils.isNotBlank(departure) ? LocalTime.parse(departure) : null); }
public void setArrival(String arrival) { this.sessionContext.setArrival( StringUtils.isNotBlank(arrival) ? LocalTime.parse(arrival) : null); }