Releases: wiremock/wiremock-spring-boot
v2.0.0
v1.0.2
What's Changed
- Add support for nested tests annotated with JUnit 5's
@Nestedby @maciejwalkowiak in #11 - Upgrade to Spring Boot 3.1.5 by @maciejwalkowiak in #12
- Upgrade Wiremock to 2.35.1 by @maciejwalkowiak in #13
- Manage JUnit version with Spring Boot BOM. by @maciejwalkowiak in #14
Full Changelog: v1.0.1...v1.0.2
1.0.1
What's Changed
- Introduce
InjectWireMockannotation to avoidWireMocknaming collision by @maciejwalkowiak in #9
Full Changelog: v1.0.0...v1.0.1
1.0.0
No changes since 0.1.0. v1.0.0 is the same code base but released to Maven Central.
WireMock Spring Boot library drastically simplifies WireMock configuration in a Spring Boot and JUnit 5 application.
🤩 Highlights
- fully declarative WireMock setup
- support for multiple WireMockServer instances - one per HTTP client as recommended in the WireMock documentation
- automatically sets Spring environment properties
- does not pollute Spring application context with extra beans
- configuring WireMock extensions via
@ConfigureWireMock(extensions = ...) - configuring stub locations via
@ConfigureWireMock(stubLocations = ...)
✨ How to use
Use @EnableWireMock with @ConfigureWireMock with tests annotated that use SpringExtension, like @SpringBootTest:
@SpringBootTest
@EnableWireMock({
@ConfigureWireMock(name = "user-service", property = "user-client.url")
})
class TodoControllerTests {
@WireMock("user-service")
private WireMockServer wiremock;
@Autowired
private Environment env;
@Test
void aTest() {
env.getProperty("user-client.url"); // returns a URL to WireMockServer instance
wiremock.stubFor(...);
}
}@EnableWireMockadds test context customizer and enablesWireMockSpringExtension@ConfigureWireMockcreates aWireMockServerand passes theWireMockServer#baseUrlto a Spring environment property with a name given byproperty.@WireMockinjectsWireMockServerinstance to a test
📢 Feedback is much appreciated!
If you find this library useful, consider ❤️ Sponsoring the project! Thank you!
0.1.0
WireMock Spring Boot library drastically simplifies WireMock configuration in a Spring Boot and JUnit 5 application.
🤩 Highlights
- fully declarative WireMock setup
- support for multiple WireMockServer instances - one per HTTP client as recommended in the WireMock documentation
- automatically sets Spring environment properties
- does not pollute Spring application context with extra beans
- configuring WireMock extensions via
@ConfigureWireMock(extensions = ...) - configuring stub locations via
@ConfigureWireMock(stubLocations = ...)
✨ How to use
Use @EnableWireMock with @ConfigureWireMock with tests annotated that use SpringExtension, like @SpringBootTest:
@SpringBootTest
@EnableWireMock({
@ConfigureWireMock(name = "user-service", property = "user-client.url")
})
class TodoControllerTests {
@WireMock("user-service")
private WireMockServer wiremock;
@Autowired
private Environment env;
@Test
void aTest() {
env.getProperty("user-client.url"); // returns a URL to WireMockServer instance
wiremock.stubFor(...);
}
}@EnableWireMockadds test context customizer and enablesWireMockSpringExtension@ConfigureWireMockcreates aWireMockServerand passes theWireMockServer#baseUrlto a Spring environment property with a name given byproperty.@WireMockinjectsWireMockServerinstance to a test
📢 Feedback is much appreciated!
If you find this library useful, consider ❤️ Sponsoring the project! Thank you!