34 lines
874 B
Java
34 lines
874 B
Java
package appointmentplanner;
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
import appointmentplanner.api.AppointmentData;
|
|
import java.time.Duration;
|
|
import org.junit.jupiter.params.ParameterizedTest;
|
|
import org.junit.jupiter.params.provider.CsvSource;
|
|
|
|
public class AppointmentDataTest {
|
|
|
|
@ParameterizedTest
|
|
@CsvSource({ "56", "-5", "30" })
|
|
void getDurationTest(long duration) {
|
|
Duration dur = Duration.ofHours(duration);
|
|
|
|
AppointmentData instnace = new AppointmentDataImpl(dur, "smth");
|
|
|
|
assertThat(instnace.duration()).isEqualTo(dur);
|
|
}
|
|
|
|
@ParameterizedTest
|
|
@CsvSource({ "one", "two", "three" })
|
|
void getDescriptionTest(String desc) {
|
|
String descString = desc;
|
|
|
|
AppointmentData instance = new AppointmentDataImpl(
|
|
Duration.ofDays(5),
|
|
desc);
|
|
|
|
assertThat(instance.description()).isEqualTo(descString);
|
|
}
|
|
}
|