Skip to content

Commit

Permalink
test: 친구 삭제 Controller 테스트 코드 추가 (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyeong-hyeok committed Sep 20, 2023
1 parent 3bc39c2 commit 965b7a0
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

@ExtendWith(MockitoExtension.class)
Expand Down Expand Up @@ -83,4 +82,19 @@ void setUp() {
result.andExpect(status().isNoContent());
verify(friendService, times(1)).saveFriend(anyString(), anyLong());
}

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

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

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

0 comments on commit 965b7a0

Please sign in to comment.