Skip to content

Commit

Permalink
feat: 친구 요청 삭제 Controller 테스트 코드 추가 (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyeong-hyeok committed Sep 17, 2023
1 parent f5b59d9 commit 37d40ae
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.project.mapdagu.domain.friendRequest.controller;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.project.mapdagu.domain.friend.controller.FriendController;
import com.project.mapdagu.domain.friend.service.FriendService;
import com.project.mapdagu.domain.friendRequest.service.FriendRequestService;
import com.project.mapdagu.utils.TestUserArgumentResolver;
import org.junit.jupiter.api.BeforeEach;
Expand All @@ -21,6 +19,7 @@
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

Expand Down Expand Up @@ -57,4 +56,19 @@ void setUp() {
verify(friendRequestService, times(1)).saveFriendRequest(anyString(), anyLong());
}

@Test
void 친구_요청_삭제() throws Exception {
//given
Long friendId = 1L;

// when
ResultActions result = mockMvc.perform(
delete("/api/friends/request/{friendId}", friendId)
);

//then
result.andExpect(status().isNoContent());
verify(friendRequestService, times(1)).deleteFriendRequest(anyString(), anyLong());
}

}

0 comments on commit 37d40ae

Please sign in to comment.