Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- bash
- Mac
- grep
- find
- lsof
- vscode
- netsh
- xargs
- Source
- port
- maVen
- GIT
- import
- 네트워크
- Windows
- web.xml
- tomcat
- Quartz
- resource
- ssh
- context
- 단축키
- VirtualBox
- Eclipse
- IntelliJ
- profile
- JavaScript
- Windows 10
- 줄바꿈 문자
- plugin
Archives
- Today
- Total
develog
[junit5] controller test @SpringBootTest 본문
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.web.servlet.MockMvc;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK)
@AutoConfigureMockMvc
public class MyControllerTest {
@Autowired
MyController myController;
@Autowired
MockMvc mockMvc;
@Autowired
ObjectMapper objectMapper;
@Test
void test_00() throws Exception {
assertThat(myController).isNotNull();
assertThat(mockMvc).isNotNull();
assertThat(objectMapper).isNotNull();
}
}
'Dev > junit' 카테고리의 다른 글
[junit5] mockito (0) | 2020.03.07 |
---|---|
[junit5] controller test @WebMvcTest (0) | 2020.03.02 |
[Junit] Test Assertion (0) | 2019.12.23 |
[junit4] pom.xml (0) | 2019.08.27 |
[junit] spring junit 설정2 (0) | 2019.08.02 |
Comments