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
- 공통표준용어
- JavaScript
- bash
- Quartz
- 단축키
- netsh
- web.xml
- Eclipse
- DB 도메인
- 네트워크
- Windows 10
- GIT
- tomcat
- ssh
- grep
- lsof
- xargs
- port
- copy-dependencies
- find
- resource
- Windows
- import
- Mac
- VirtualBox
- IntelliJ
- profile
- maVen
- Source
- context
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