https://github.com/lanwen/wiremock-junit5
Wiremock extension to inject server into JUnit5 tests
https://github.com/lanwen/wiremock-junit5
junit5 mock-server wiremock
Last synced: about 1 year ago
JSON representation
Wiremock extension to inject server into JUnit5 tests
- Host: GitHub
- URL: https://github.com/lanwen/wiremock-junit5
- Owner: lanwen
- License: apache-2.0
- Created: 2017-06-13T14:03:25.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-08-15T11:46:28.000Z (almost 7 years ago)
- Last Synced: 2025-03-17T23:51:57.703Z (about 1 year ago)
- Topics: junit5, mock-server, wiremock
- Language: Java
- Homepage:
- Size: 29.3 KB
- Stars: 47
- Watchers: 2
- Forks: 5
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Wiremock JUnit5
[](https://codecov.io/gh/lanwen/wiremock-junit5)
[](https://maven-badges.herokuapp.com/maven-central/ru.lanwen.wiremock/wiremock-junit5)
Simple extension to inject ready-to-use wiremock server to JUnit5 test
## Start Guide
1. Add dependency
```
ru.lanwen.wiremock:wiremock-junit5:${wiremock-junit5.version}
```
2. Create JUnit5 test:
```java
@ExtendWith({
WiremockResolver.class,
WiremockUriResolver.class
})
class WiremockJUnit5Test {
@Test
void shouldInjectWiremock(@Wiremock WireMockServer server, @WiremockUri String uri) {
customize(server); // your setup
SomeApiClient api = SomeApiClient.connect(uri);
Response response = api.call();
assertThat(response.headers(), hasSize(1));
}
}
```
### Reuse customization
With `ru.lanwen.wiremock.config.WiremockCustomizer` and `ru.lanwen.wiremock.config.WiremockConfigFactory`
you can reuse logic of initial setup.
Please look into test for example.
## Compatibility with JUnit5
- *v1.0.1* `->` *M4*
- *v1.1.0* `->` *RC2*
- *v1.1.1* `->` *GA*