|
|
|
@ -0,0 +1,29 @@ |
|
|
|
package com.hxhq.business.controller; |
|
|
|
|
|
|
|
import com.hxhq.system.HxhqSystemApplication; |
|
|
|
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.mock.web.MockHttpServletResponse; |
|
|
|
import org.springframework.test.web.servlet.MockMvc; |
|
|
|
import org.springframework.test.web.servlet.ResultActions; |
|
|
|
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; |
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
|
|
|
|
|
@AutoConfigureMockMvc |
|
|
|
@SpringBootTest(classes = HxhqSystemApplication.class,webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) |
|
|
|
public class TestControllerTest { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private MockMvc mvc; |
|
|
|
|
|
|
|
@Test |
|
|
|
public void testGet() throws Exception { |
|
|
|
ResultActions perform = mvc.perform(MockMvcRequestBuilders.get("/business/test/info?id=1")); |
|
|
|
MockHttpServletResponse response = perform.andReturn().getResponse(); |
|
|
|
System.out.println(response.getContentAsString()); |
|
|
|
} |
|
|
|
|
|
|
|
} |