@SpringBootTest @RunWith(SpringRunner.class) @AutoConfigureMockMvc @Transactional public class InterceptorTest { @Autowired private MockMvc mockMvc; @Before public void setUp() throws Exception { } @Test public void testServiceSecret() throws Exception { mockMvc.perform(get("/v1/status/xxx") .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)) .andDo(print()) .andExpect(status().is5xxServerError()); } }
mock mvc contrller test
最新推荐文章于 2021-03-15 16:34:49 发布