22
33import com .back .domain .member .member .entity .Member ;
44import com .back .domain .member .member .service .AuthTokenService ;
5- import com .back .domain .member .mentee .entity .Mentee ;
65import com .back .domain .member .mentor .entity .Mentor ;
76import com .back .domain .mentoring .mentoring .entity .Mentoring ;
8- import com .back .domain .mentoring .reservation .constant .ReservationStatus ;
9- import com .back .domain .mentoring .reservation .entity .Reservation ;
107import com .back .domain .mentoring .slot .entity .MentorSlot ;
118import com .back .domain .mentoring .slot .error .MentorSlotErrorCode ;
129import com .back .domain .mentoring .slot .repository .MentorSlotRepository ;
@@ -219,15 +216,6 @@ void createMentorSlotFailInValidDate() throws Exception {
219216 .andExpect (jsonPath ("$.msg" ).value ("종료 일시는 시작 일시보다 이후여야 합니다." ));
220217 }
221218
222- @ Test
223- @ DisplayName ("멘토 슬롯 생성 실패 - 기존 슬롯과 시간 겹치는 경우" )
224- void createMentorSlotFailOverlappingSlots () throws Exception {
225- performCreateMentorSlot (mentor .getId (), mentorToken , "2025-10-01T11:00:00" , "2025-10-01T11:20:00" )
226- .andExpect (status ().isConflict ())
227- .andExpect (jsonPath ("$.resultCode" ).value ("409-1" ))
228- .andExpect (jsonPath ("$.msg" ).value ("선택한 시간은 이미 예약된 시간대입니다." ));
229- }
230-
231219
232220 // ===== 슬롯 반복 생성 =====
233221 @ Test
@@ -308,83 +296,6 @@ void updateMentorSlotSuccess() throws Exception {
308296 .andExpect (jsonPath ("$.data.mentorSlotStatus" ).value ("AVAILABLE" ));
309297 }
310298
311- @ Test
312- @ DisplayName ("멘토 슬롯 수정 성공 - 비활성화된 예약이 있는 경우" )
313- void updateMentorSlotSuccessReserved () throws Exception {
314- MentorSlot mentorSlot = mentorSlots .getFirst ();
315-
316- // 예약 생성 및 취소
317- Member menteeMember = memberFixture .createMenteeMember ();
318- Mentee mentee = memberFixture .createMentee (menteeMember );
319- Reservation reservation = mentoringFixture .createReservation (mentoring , mentee , mentorSlot );
320- reservation .updateStatus (ReservationStatus .CANCELED );
321-
322- // 수정 API
323- LocalDateTime updateEndDate = mentorSlot .getEndDateTime ().minusMinutes (10 );
324- ResultActions resultActions = performUpdateMentorSlot (mentor .getId (), mentorToken , mentorSlot , updateEndDate );
325-
326- DateTimeFormatter formatter = DateTimeFormatter .ofPattern ("yyyy-MM-dd'T'HH:mm:ss" );
327- String expectedEndDate = updateEndDate .format (formatter );
328-
329- resultActions
330- .andExpect (status ().isOk ())
331- .andExpect (jsonPath ("$.resultCode" ).value ("200" ))
332- .andExpect (jsonPath ("$.msg" ).value ("멘토의 예약 가능 일정이 수정되었습니다." ))
333- .andExpect (jsonPath ("$.data.mentorSlotId" ).value (mentorSlot .getId ()))
334- .andExpect (jsonPath ("$.data.mentorId" ).value (mentorSlot .getMentor ().getId ()))
335- .andExpect (jsonPath ("$.data.mentoringId" ).value (mentoring .getId ()))
336- .andExpect (jsonPath ("$.data.mentoringTitle" ).value (mentoring .getTitle ()))
337- .andExpect (jsonPath ("$.data.endDateTime" ).value (expectedEndDate ))
338- .andExpect (jsonPath ("$.data.mentorSlotStatus" ).value ("AVAILABLE" ));
339- }
340-
341- @ Test
342- @ DisplayName ("멘토 슬롯 수정 실패 - 작성자가 아닌 경우" )
343- void updateMentorSlotFailNotOwner () throws Exception {
344- Member mentorMember2 = memberFixture .createMentorMember ();
345- Mentor mentor2 = memberFixture .createMentor (mentorMember2 );
346- mentoringFixture .createMentoring (mentor2 );
347- String token = authTokenService .genAccessToken (mentorMember2 );
348-
349- MentorSlot mentorSlot = mentorSlots .getFirst ();
350- LocalDateTime updateEndDate = mentorSlots .get (1 ).getEndDateTime ();
351-
352- performUpdateMentorSlot (mentor2 .getId (), token , mentorSlot , updateEndDate )
353- .andExpect (status ().isForbidden ())
354- .andExpect (jsonPath ("$.resultCode" ).value ("403-1" ))
355- .andExpect (jsonPath ("$.msg" ).value ("접근 권한이 없습니다." ));
356- }
357-
358- @ Test
359- @ DisplayName ("멘토 슬롯 수정 실패 - 기존 슬롯과 겹치는지 검사" )
360- void updateMentorSlotFailOverlapping () throws Exception {
361- MentorSlot mentorSlot = mentorSlots .getFirst ();
362- LocalDateTime updateEndDate = mentorSlots .get (1 ).getEndDateTime ();
363-
364- performUpdateMentorSlot (mentor .getId (), mentorToken , mentorSlot , updateEndDate )
365- .andExpect (status ().isConflict ())
366- .andExpect (jsonPath ("$.resultCode" ).value ("409-1" ))
367- .andExpect (jsonPath ("$.msg" ).value ("선택한 시간은 이미 예약된 시간대입니다." ));
368- }
369-
370- @ Test
371- @ DisplayName ("멘토 슬롯 수정 실패 - 활성화된 예약이 있는 경우" )
372- void updateMentorSlotFailReserved () throws Exception {
373- MentorSlot mentorSlot = mentorSlots .getFirst ();
374-
375- // 예약 생성
376- Member menteeMember = memberFixture .createMenteeMember ();
377- Mentee mentee = memberFixture .createMentee (menteeMember );
378- mentoringFixture .createReservation (mentoring , mentee , mentorSlot );
379-
380- LocalDateTime updateEndDate = mentorSlot .getEndDateTime ().minusMinutes (10 );
381-
382- performUpdateMentorSlot (mentor .getId (), mentorToken , mentorSlot , updateEndDate )
383- .andExpect (status ().isBadRequest ())
384- .andExpect (jsonPath ("$.resultCode" ).value ("400-6" ))
385- .andExpect (jsonPath ("$.msg" ).value ("예약된 슬롯은 수정할 수 없습니다." ));
386- }
387-
388299
389300 // ===== delete =====
390301
@@ -407,36 +318,6 @@ void deleteMentorSlotSuccess() throws Exception {
407318 assertThat (afterCnt ).isEqualTo (beforeCnt - 1 );
408319 }
409320
410- @ Test
411- @ DisplayName ("멘토 슬롯 삭제 실패 - 작성자가 아닌 경우" )
412- void deleteMentorSlotFailNotOwner () throws Exception {
413- Member mentorMember2 = memberFixture .createMentorMember ();
414- memberFixture .createMentor (mentorMember2 );
415- String token = authTokenService .genAccessToken (mentorMember2 );
416-
417- performDeleteMentorSlot (mentorSlots .getFirst (), token )
418- .andExpect (status ().isForbidden ())
419- .andExpect (jsonPath ("$.resultCode" ).value ("403-1" ))
420- .andExpect (jsonPath ("$.msg" ).value ("접근 권한이 없습니다." ));
421- }
422-
423- @ Test
424- @ DisplayName ("멘토 슬롯 삭제 실패 - 예약이 있는 경우" )
425- void deleteMentorSlotFailReserved () throws Exception {
426- MentorSlot mentorSlot = mentorSlots .getFirst ();
427-
428- // 예약 생성 및 취소
429- Member menteeMember = memberFixture .createMenteeMember ();
430- Mentee mentee = memberFixture .createMentee (menteeMember );
431- Reservation reservation = mentoringFixture .createReservation (mentoring , mentee , mentorSlot );
432- reservation .updateStatus (ReservationStatus .CANCELED );
433-
434- performDeleteMentorSlot (mentorSlot , mentorToken )
435- .andExpect (status ().isBadRequest ())
436- .andExpect (jsonPath ("$.resultCode" ).value ("400-7" ))
437- .andExpect (jsonPath ("$.msg" ).value ("예약된 슬롯은 삭제할 수 없습니다." ));
438- }
439-
440321
441322 // ===== perform =====
442323
0 commit comments