From bfa23605fc642fea285de63e4d23068a29623132 Mon Sep 17 00:00:00 2001 From: Hongdonggeon Date: Thu, 20 Oct 2022 10:34:46 +0900 Subject: [PATCH] =?UTF-8?q?test:=20=EC=8B=9C=EA=B0=84=EC=97=90=20=EB=94=B0?= =?UTF-8?q?=EB=9D=BC=20=EC=8B=A4=ED=8C=A8=ED=96=88=EB=8D=98=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../moragora/acceptance/AttendanceAcceptanceTest.java | 11 +++++++++-- .../moragora/acceptance/MeetingAcceptanceTest.java | 9 +++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/backend/src/test/java/com/woowacourse/moragora/acceptance/AttendanceAcceptanceTest.java b/backend/src/test/java/com/woowacourse/moragora/acceptance/AttendanceAcceptanceTest.java index 6fe6035e..b1d29053 100644 --- a/backend/src/test/java/com/woowacourse/moragora/acceptance/AttendanceAcceptanceTest.java +++ b/backend/src/test/java/com/woowacourse/moragora/acceptance/AttendanceAcceptanceTest.java @@ -209,10 +209,14 @@ void useCoffeeStack() { final List userIds = saveUsers(createUsers()); final Meeting meeting = MORAGORA.create(); final int meetingId = saveMeeting(token, userIds, meeting); + final LocalDate date = LocalDate.now(); - final Event event = EVENT_WITHOUT_DATE.createEventOnDate(meeting, date); + final LocalTime time = LocalTime.of(10, 0); + final LocalDateTime now = LocalDateTime.of(date, time.plusMinutes(1)); + final Event event = EVENT_WITHOUT_DATE.createEventOnDateAndTime(meeting, date, time); given(serverTimeManager.getDate()).willReturn(date); + given(serverTimeManager.getDateAndTime()).willReturn(now); saveEvents(token, List.of(event), (long) meetingId); @@ -263,13 +267,16 @@ void showUserCoffeeStats() { final Long masterId = signUp(master); final String token = login(master); final LocalDate date = LocalDate.now(); + final LocalTime time = LocalTime.of(10, 0); + final LocalDateTime now = LocalDateTime.of(date, time.plusMinutes(1)); final List userIds = saveUsers(createUsers()); final Meeting meeting = MORAGORA.create(); final int meetingId = saveMeeting(token, userIds, meeting); - final Event event = EVENT_WITHOUT_DATE.createEventOnDate(meeting, date); + final Event event = EVENT_WITHOUT_DATE.createEventOnDateAndTime(meeting, date, time); given(serverTimeManager.getDate()).willReturn(date); + given(serverTimeManager.getDateAndTime()).willReturn(now); saveEvents(token, List.of(event), (long) meetingId); // when diff --git a/backend/src/test/java/com/woowacourse/moragora/acceptance/MeetingAcceptanceTest.java b/backend/src/test/java/com/woowacourse/moragora/acceptance/MeetingAcceptanceTest.java index 149623d4..916f886c 100644 --- a/backend/src/test/java/com/woowacourse/moragora/acceptance/MeetingAcceptanceTest.java +++ b/backend/src/test/java/com/woowacourse/moragora/acceptance/MeetingAcceptanceTest.java @@ -23,6 +23,7 @@ import com.woowacourse.moragora.dto.request.meeting.MeetingUpdateRequest; import io.restassured.response.ValidatableResponse; import java.time.LocalDate; +import java.time.LocalDateTime; import java.time.LocalTime; import java.time.format.DateTimeFormatter; import java.util.List; @@ -107,11 +108,15 @@ void findMy() { final int meetingId2 = saveMeeting(token, ids, meeting2); final LocalDate today = LocalDate.now(); - final Event event = EVENT_WITHOUT_DATE.createEventOnDate(meeting1, today); + final LocalTime time = LocalTime.of(10, 0); + final LocalDateTime now = LocalDateTime.of(today, time.plusMinutes(1)); + + final Event event = EVENT_WITHOUT_DATE.createEventOnDateAndTime(meeting1, today, time); given(serverTimeManager.getDate()) .willReturn(event.getDate()); - given(serverTimeManager.isAttendanceOpen(LocalTime.of(10, 0))) + given(serverTimeManager.getDateAndTime()).willReturn(now); + given(serverTimeManager.isAttendanceOpen(time)) .willReturn(true); given(serverTimeManager.calculateOpenTime(event.getStartTime())) .willReturn(LocalTime.of(9, 30));