@AutoConfigureMockMvc
@SpringBootTest
class UserControllerTest {
@Autowired
MockMvc mockMvc;
@Autowired
ObjectMapper objectMapper;
@Test
void signup_success() throws Exception {
UserDto userDto = UserDto.builder()
.id("icwgi897")
.password("1234")
.level(UserLevel.USER)
.build();
String reqeust = objectMapper.writeValueAsString(userDto);
System.out.println(reqeust);
mockMvc.perform(post("/signup")
.content(reqeust).contentType(MediaType.APPLICATION_JSON))
.andDo(print())
.andExpect(status().isOk());
}
}
스프링부트 2.5.0 매우 잘돌아감 빨간밑줄도 안뜸 InteliJ
스프링부트 2.5.0 매우 잘돌아감 빨간밑줄도 안뜸 Gradle
2.7.0버전 다 바꾸고 + auto configure도 버전 2.7.0 로 하니까돌아감 InteliJ
2.7.0버전 다 바꾸고 + auto configure도 버전 2.7.0 + Gradle 돌아감
계속 문제가됬던것은 AutoCofigureMockMvc를 적어야하는데 WebMvc를 적어서 고생했다..