feat: apdata tests
This commit is contained in:
@@ -0,0 +1,33 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user