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 .dto .request .MentoringRequest ;
87import com .back .domain .mentoring .mentoring .entity .Mentoring ;
98import com .back .domain .mentoring .mentoring .error .MentoringErrorCode ;
109import com .back .domain .mentoring .mentoring .repository .MentoringRepository ;
1110import com .back .domain .mentoring .reservation .repository .ReservationRepository ;
12- import com .back .domain .mentoring .slot .entity .MentorSlot ;
1311import com .back .domain .mentoring .slot .repository .MentorSlotRepository ;
1412import com .back .fixture .MemberTestFixture ;
15- import com .back .fixture .MentoringTestFixture ;
13+ import com .back .fixture .mentoring . MentoringTestFixture ;
1614import com .back .global .exception .ServiceException ;
1715import com .back .standard .util .Ut ;
1816import jakarta .servlet .http .Cookie ;
@@ -53,7 +51,6 @@ class MentoringControllerTest {
5351 private static final String MENTORING_URL = "/mentorings" ;
5452
5553 private Mentor mentor ;
56- private Mentee mentee ;
5754 private String mentorToken ;
5855 private String menteeToken ;
5956
@@ -65,7 +62,7 @@ void setUp() {
6562
6663 // Mentee
6764 Member menteeMember = memberFixture .createMenteeMember ();
68- mentee = memberFixture .createMentee (menteeMember );
65+ memberFixture .createMentee (menteeMember );
6966
7067 // JWT 발급
7168 mentorToken = authTokenService .genAccessToken (mentorMember );
@@ -222,17 +219,6 @@ void createMentoringFailNotMentor() throws Exception {
222219 .andExpect (jsonPath ("$.msg" ).value ("멘토를 찾을 수 없습니다." ));
223220 }
224221
225- @ Test
226- @ DisplayName ("멘토링 생성 실패 - 멘토당 멘토링 1개 제한" )
227- void createMentoringFailDuplicate () throws Exception {
228- mentoringFixture .createMentoring (mentor );
229-
230- performCreateMentoring (mentorToken )
231- .andExpect (status ().isConflict ())
232- .andExpect (jsonPath ("$.resultCode" ).value ("409-1" ))
233- .andExpect (jsonPath ("$.msg" ).value ("이미 멘토링 정보가 존재합니다." ));
234- }
235-
236222
237223 // ===== 멘토링 수정 =====
238224
@@ -283,22 +269,6 @@ void updateMentoringFailNotMentoring() throws Exception {
283269 .andExpect (jsonPath ("$.msg" ).value ("멘토링을 찾을 수 없습니다." ));
284270 }
285271
286- @ Test
287- @ DisplayName ("멘토링 수정 실패 - 멘토링 소유자가 아닌 경우" )
288- void updateMentoringFailNotOwner () throws Exception {
289- Mentoring mentoring = mentoringFixture .createMentoring (mentor );
290-
291- // 다른 멘토
292- Member otherMentor = memberFixture .createMentorMember ();
293- memberFixture .createMentor (otherMentor );
294- String token = authTokenService .genAccessToken (otherMentor );
295-
296- performUpdateMentoring (mentoring .getId (), token )
297- .andExpect (status ().isForbidden ())
298- .andExpect (jsonPath ("$.resultCode" ).value ("403-1" ))
299- .andExpect (jsonPath ("$.msg" ).value ("해당 멘토링에 대한 권한이 없습니다." ));
300- }
301-
302272
303273 // ===== 멘토링 삭제 =====
304274
@@ -374,36 +344,6 @@ void deleteMentoringFailNotMentoring() throws Exception {
374344 .andExpect (jsonPath ("$.msg" ).value ("멘토링을 찾을 수 없습니다." ));
375345 }
376346
377- @ Test
378- @ DisplayName ("멘토링 삭제 실패 - 멘토링 소유자가 아닌 경우" )
379- void deleteMentoringFailNotOwner () throws Exception {
380- Mentoring mentoring = mentoringFixture .createMentoring (mentor );
381-
382- // 다른 멘토
383- Member otherMentor = memberFixture .createMentorMember ();
384- memberFixture .createMentor (otherMentor );
385- String token = authTokenService .genAccessToken (otherMentor );
386-
387- performDeleteMentoring (mentoring .getId (), token )
388- .andExpect (status ().isForbidden ())
389- .andExpect (jsonPath ("$.resultCode" ).value ("403-1" ))
390- .andExpect (jsonPath ("$.msg" ).value ("해당 멘토링에 대한 권한이 없습니다." ));
391- }
392-
393- @ Test
394- @ DisplayName ("멘토링 삭제 실패 - 예약 정보가 있는 경우" )
395- void deleteMentoringFailExistsReservation () throws Exception {
396- Mentoring mentoring = mentoringFixture .createMentoring (mentor );
397- MentorSlot mentorSlot = mentoringFixture .createMentorSlot (mentor );
398- mentoringFixture .createReservation (mentoring , mentee , mentorSlot );
399-
400- performDeleteMentoring (mentoring .getId (), mentorToken )
401- .andExpect (status ().isBadRequest ())
402- .andExpect (jsonPath ("$.resultCode" ).value ("400-1" ))
403- .andExpect (jsonPath ("$.msg" ).value ("예약 이력이 있는 멘토링은 삭제할 수 없습니다." ));
404-
405- }
406-
407347
408348 // ===== perform =====
409349
0 commit comments