| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [View Raw Code] [Original HTTPS Page] |
Mock Server can be used to mock HTTP services by matching requests against user-defined expectations.
The following example shows how to start Mockserver.
Creating a MockServer container inside_block:creatingProxy
And how to set a simple expectation using the Java MockServerClient.
Setting a simple expectation inside_block:testSimpleExpectation
Add the following dependency to your pom.xml/build.gradle file:
=== "Gradle" groovy testImplementation "org.testcontainers:mockserver:{{latest_version}}" === "Maven" xml <dependency> <groupId>org.testcontainers</groupId> <artifactId>mockserver</artifactId> <version>{{latest_version}}</version> <scope>test</scope> </dependency>
Additionally, don't forget to add a client dependency org.mock-server:mockserver-client-java to be able to set expectations, it's not provided by the testcontainers module. Client version should match to the version in a container tag.
| Back | FazBrowse Home | New Git URL |