Ejemplo n.º 1
0
 @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);
 }
Ejemplo n.º 2
0
  @Test
  public void defaultValues() {
    ArchiveRecurrence archiveRecurrence =
        ArchiveRecurrence.builder()
            .dayOfMonth(DayOfMonth.last())
            .dayOfWeek(DayOfWeek.MONDAY)
            .dayOfYear(DayOfYear.of(1))
            .repeat(RepeatKind.MONTHLY)
            .build();

    SchedulingConfiguration configuration = SchedulingConfiguration.DEFAULT_VALUES_BUILDER;
    assertThat(configuration.getRepeatKind()).isEqualTo(archiveRecurrence.getRepeatKind());
    assertThat(configuration.getDayOfMonth()).isEqualTo(archiveRecurrence.getDayOfMonth());
    assertThat(configuration.getDayOfWeek()).isEqualTo(archiveRecurrence.getDayOfWeek());
    assertThat(configuration.getDayOfYear()).isEqualTo(archiveRecurrence.getDayOfYear());
    assertThat(configuration.getHour()).isEqualTo(0);
    assertThat(configuration.getMinute()).isEqualTo(0);
    assertThat(configuration.getRecurrence()).isEqualTo(archiveRecurrence);
  }