https://github.com/ricall/junit5-wiremock
Java library for running WireMock using JUnit5
https://github.com/ricall/junit5-wiremock
gradle java junit junit-jupiter junit5 testing-tools wiremock wiremock-server
Last synced: 3 months ago
JSON representation
Java library for running WireMock using JUnit5
- Host: GitHub
- URL: https://github.com/ricall/junit5-wiremock
- Owner: ricall
- License: mit
- Created: 2021-01-13T08:45:50.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-05-22T15:30:59.000Z (about 4 years ago)
- Last Synced: 2025-01-17T02:15:32.242Z (4 months ago)
- Topics: gradle, java, junit, junit-jupiter, junit5, testing-tools, wiremock, wiremock-server
- Language: Java
- Homepage:
- Size: 118 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# JUnit 5 WireMock library
## What is it?
This JUnit 5 library for [Wiremock](http://wiremock.org) provides a way to run a WireMockServer in your JUnit code.
## How to use it
The wiremock library can be added to projects built using gradle or maven as shown below:### Gradle
Add the dependency to gradle
```groovy
testImplementation 'io.github.ricall.junit5-wiremock:junit5-wiremock:2.0.0'
```### Maven
Add the dependeny to mvn pom.xml
```xmlio.github.ricall.junit5-wiremock
junit5-wiremock
2.0.0
test```
### Using the `JUnit5` extension
```java
public class TestWireMockLibrary {@RegisterExtension
public MockServer server = MockServer.withPort(8085);@Test
public void verifyWiremockWorksAsExpected() {
server.stubFor(get(urlEqualTo("/hello"))
.willReturn(aResponse()
.withStatus(200)
.withBody("Hello World")));
// You can now query server.url("/hello")
}
}
```## License
This software is licensed using [MIT](https://opensource.org/licenses/MIT)