模拟REST客户端

时间:2020-07-21 13:04:32

标签: spring-boot rest mocking

我使用以下测试在我的Spring-Boot应用程序中测试我的API端点:

    public void getFreeProducts200() throws Exception {
        final MockHttpServletRequestBuilder request = MockMvcRequestBuilders.get("/api/v1/events/528409/").accept(MediaType.APPLICATION_JSON_UTF8);
        final ResultActions mvcResponse = this.mvc.perform(request);
        mvcResponse.andExpect(MockMvcResultMatchers.status().isOk()).andReturn();
    }

路径/ api / v1 / events / {0} /被映射到调用另一个REST服务的方法。 我想模拟这个基础的REST接口。我该怎么办?

0 个答案:

没有答案