유닛 테스트가 안되는 구존가?


내가 짠 코드가 유닛코드라고 생각하고 짠건데 콘솔에 보면 스프링 로고 뜨면서 시작되길래


@AutoConfigureMockMvc
@WebMvcTest(PostController.class)
@ExtendWith(MockitoExtension.class)
class PostControllerTest {


...


@DisplayName("게시물 생성 API")
@Test
void createPostApi() throws Exception {
// given
given(postService.createPost(postRequestDto)).willReturn(post1);

// when
ResultActions result = mvc.perform(post("/api/v1/posts")
.contentType(MediaType.APPLICATION_JSON)
.characterEncoding("UTF-8")
.content(objectMapper.writeValueAsString(postRequestDto)));

// then
result.andExpect(status().isCreated())
.andExpect(content().string("1"))
.andDo(print());
}