LibraryActive

WireMock JUnit 4 Rule

JUnit rule for managing WireMock instances in JUnit 4.x and JUnit 5 Vintage tests.

Open source page ↗

Product features

Product features

Class rule support

Use WireMockClassRule to keep the server running between test cases.

Direct DSL access

Configure stubs via the rule object directly, avoiding HTTP commands.

DSL access from rule

Configure stubs directly via the rule object, avoiding HTTP commands and enabling per-service rules.

Lifecycle management

Starts the server before each test method and stops afterwards.

Unmatched request verification

Verifies all requests are served by a configured stub, failing the test with VerificationException otherwise.

WireMockClassRule

Allows the WireMock server to continue running between test cases.