test: localDP constructor and getters
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package appointmentplanner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalTime;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
import appointmentplanner.api.LocalDay;
|
||||
import appointmentplanner.api.LocalDayPlan;
|
||||
|
||||
public class LocalDayPlanTest {
|
||||
|
||||
private static Stream<Arguments> provideLocalDPDataset() {
|
||||
return Stream.of(
|
||||
Arguments.of(new LocalDay(), Instant.parse("2023-01-01T08:30:00Z"), Instant.parse("2023-01-01T17:30:00Z")),
|
||||
Arguments.of(new LocalDay(), Instant.parse("2023-06-15T09:00:00Z"), Instant.parse("2023-06-15T18:00:00Z")),
|
||||
Arguments.of(new LocalDay(), Instant.parse("2024-12-31T07:00:00Z"), Instant.parse("2024-12-31T16:00:00Z")));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("provideLocalDPDataset")
|
||||
void ldPlanInit_shouldBeSuccessful(LocalDay day, Instant start, Instant end) {
|
||||
LocalDayPlan plan = new LocalDayPlanImpl(day, start, end);
|
||||
assertThat(plan).isNotNull();
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("provideLocalDPDataset")
|
||||
void ldPlanGetters_shouldReturnSetValues(LocalDay day, Instant start, Instant end) {
|
||||
LocalDayPlan plan = new LocalDayPlanImpl(day, start, end);
|
||||
|
||||
assertThat(plan.day()).isEqualTo(day);
|
||||
assertThat(plan.startOfDay()).isEqualTo(start);
|
||||
assertThat(plan.endOfDay()).isEqualTo(end);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user