**Last Update**: 17.04.2024
***
**The [JUnit Jupiter extension](https://wiremock.org/docs/junit-jupiter/) is available starting with WireMock 2.31.0**. Previous WireMock versions have to fall back to JUnit 4, a manual server lifecycle.
### Dependencies
```xml
<dependency>
<groupId>org.wiremock</groupId>
<artifactId>wiremock-standalone</artifactId>
<version>3.3.1</version>
<scope>test</scope>
</dependency>
```
### Setup
We can choose between the declarative (`@WireMockTest` on top of our test class) and programmatic registration (`@RegisterExtension` on top of a static/instance field) of the `WireMockExtension`.
**The programmatic approach offers more control over the WireMock server,** as we can pass a `WireMockConfig`:
```java
class TodoControllerJUnit5ExtensionIT {
@RegisterExtension
static WireMockExtension wireMockServer = WireMockExtension.newInstance()
.options(wireMockConfig().dynamicPort())
.build();
}
```
***
**References**:
- [WireMock - Get started](https://wiremock.org/#open-source-get-started)
- [WireMock - JUnit 5+ Jupiter - Advanced usage - programmatic](https://wiremock.org/docs/junit-jupiter/)
- [Spring Boot Integration Tests With WireMock and JUnit 5](https://rieckpil.de/spring-boot-integration-tests-with-wiremock-and-junit-5/)