From 92d18e0eb46e7e83d5f7f58eadf2fffc178252f2 Mon Sep 17 00:00:00 2001 From: SeokEui Hong Date: Sat, 25 Nov 2023 21:57:44 +0900 Subject: [PATCH] =?UTF-8?q?test:=20[#6]=20ReservationDateTest=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. createReservationDateWhichIsNotBetweenOneAndThirtyOne() - validateReservationDate() 1 ~ 31일 사이의 날짜가 아니면 IllegalArgumentException 발생시키는지 테스트 --- .../java/christmas/ReservationDateTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/test/java/christmas/ReservationDateTest.java diff --git a/src/test/java/christmas/ReservationDateTest.java b/src/test/java/christmas/ReservationDateTest.java new file mode 100644 index 00000000..e7230800 --- /dev/null +++ b/src/test/java/christmas/ReservationDateTest.java @@ -0,0 +1,19 @@ +package christmas; + +import christmas.domain.ReservationDate; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy; + +public class ReservationDateTest { + @DisplayName("예약 날짜가 12월(1~31일)에 해당하지 않으면 예외발생") + @Test + void createReservationDateWhichIsNotBetweenOneAndThirtyOne() { + assertThatThrownBy(() -> new ReservationDate(0)) + .isInstanceOf(IllegalArgumentException.class); + + assertThatThrownBy(() -> new ReservationDate(32)) + .isInstanceOf(IllegalArgumentException.class); + } +}