<dependency> <groupId>org.mock-server</groupId> <artifactId>jmockring</artifactId> <version>1.3.0</version> </dependency> import org.mockserver.integration.ClientAndServer; public class MyTest { private ClientAndServer mockServer; @Before public void setUp() { mockServer = ClientAndServer.startClientAndServer(1080); } @After public void tearDown() { mockServer.stop(); } } import static org.mockserver.model.HttpRequest.*; import static org.mockserver.model.HttpResponse.*; @Test public void testMockedDependency() { mockServer .when(request().withMethod("GET").withPath("/api")) .respond(response().withStatusCode(200).withBody("Mocked response")); }


上一篇:
下一篇:
切换中文