123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- package com.its.op;
- import com.fasterxml.jackson.databind.ObjectMapper;
- import com.its.op.dto.its.cctv.TbCctvCtlrDto;
- import org.junit.jupiter.api.BeforeEach;
- import org.junit.jupiter.api.DisplayName;
- import org.junit.jupiter.api.Test;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.test.web.servlet.MockMvc;
- import org.springframework.test.web.servlet.setup.MockMvcBuilders;
- import org.springframework.web.context.WebApplicationContext;
- //@WebMvcTest(TbCctvCtlrController.class)
- public class TbCctvCtlrControllerTest {
- @Autowired
- private MockMvc mockMvc;
- @Autowired
- private WebApplicationContext ctx;
- @Autowired
- private ObjectMapper objectMapper;
- @BeforeEach
- void setUp() {
- //RequestResponseBodyMethodProcessor
- mockMvc = MockMvcBuilders.webAppContextSetup(ctx)
- // .alwaysDo(print())
- .build();
- }
- @Test
- @DisplayName("Post @Valid 테스트")
- void test() throws Exception {
- final String obj = objectMapper.writeValueAsString(new TbCctvCtlrDto.TbCctvCtlrUpdReq());
- // mockMvc.perform(post("/api/cctv/manager/info/1")
- // .content(obj)
- // .contentType(MediaType.APPLICATION_JSON_VALUE))
- // .andExpect(status().isBadRequest());
- }
- @Test
- @DisplayName("Get @Validated 테스트")
- void hiTest() throws Exception {
- // mockMvc.perform(get("/api/cctv/manager/info/1")
- // //.param("value", "0")
- // .contentType(MediaType.APPLICATION_JSON_VALUE)
- // )
- // .andExpect(status().isInternalServerError());
- }
- }
|