@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); }
@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(); }