test: localDP constructor and getters
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
package appointmentplanner;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import appointmentplanner.api.Appointment;
|
||||
import appointmentplanner.api.AppointmentData;
|
||||
import appointmentplanner.api.AppointmentRequest;
|
||||
import appointmentplanner.api.LocalDay;
|
||||
import appointmentplanner.api.LocalDayPlan;
|
||||
import appointmentplanner.api.TimePreference;
|
||||
import appointmentplanner.api.TimeSlot;
|
||||
|
||||
public class LocalDayPlanImpl implements LocalDayPlan {
|
||||
|
||||
public LocalDayPlanImpl(LocalDay day, Instant startOfDay, Instant endOfDay) {
|
||||
throw new UnsupportedOperationException("Unimplemented constructor 'LocalDayPlanImpl'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalDay day() {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'day'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instant startOfDay() {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'startOfDay'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instant endOfDay() {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'endOfDay'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Appointment> addAppointment(AppointmentData appointmentData, LocalTime start,
|
||||
TimePreference fallback) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'addAppointment'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Appointment> addAppointment(AppointmentData appointmentData, LocalTime startTime) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'addAppointment'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Appointment> addAppointment(AppointmentData appointmentData, TimePreference preference) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'addAppointment'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppointmentRequest removeAppointment(Appointment appointment) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'removeAppointment'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AppointmentRequest> removeAppointments(Predicate<Appointment> filter) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'removeAppointments'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Appointment> appointments() {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'appointments'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TimeSlot> findMatchingFreeSlotsOfDuration(Duration duration, List<LocalDayPlan> plans) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findMatchingFreeSlotsOfDuration'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TimeSlot> findGapsFitting(Duration duration) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findGapsFitting'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Appointment> findAppointments(Predicate<Appointment> filter) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findAppointments'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Appointment appointment) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'contains'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int nrOfAppointments() {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'nrOfAppointments'");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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