Upgrade WireMock to 4.x

MSAL

Upgrade WireMock to 4.x, which requires Java 17, ships Jetty 12.1 by default, splits JUnit support out into separate modules and makes the primary domain classes immutable. Note that RequestMethod.GET_OR_HEAD is a multi method matcher in 4.x rather than a method named GET_OR_HEAD, so code reading a name off that particular constant needs a look.

org.openrewrite.java.testing.wiremock.Wiremock3to4Migration
mod run . --recipe=org.openrewrite.java.testing.wiremock.Wiremock3to4Migration

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Keep a single Content-Type response header while still on WireMock 3
  2. Move Jetty EE10 usages to EE11 alongside wiremock-jetty12
  3. Upgrade WireMock to 3.x
  4. Change Gradle or Maven dependency org.wiremock:wiremock-jetty12
  5. Upgrade Gradle or Maven dependency versions org.wiremock:wiremock:4.0.0-beta.41
  6. Upgrade Gradle or Maven dependency versions org.wiremock:wiremock-standalone:4.0.0-beta.41
  7. Add Gradle or Maven dependency org.wiremock:wiremock-junit5:4.0.0-beta.41
  8. Add Gradle or Maven dependency org.wiremock:wiremock-junit4:4.0.0-beta.41
  9. Add Gradle or Maven dependency org.eclipse.jetty:jetty-client:12.1.x
  10. Add Gradle or Maven dependency org.eclipse.jetty:jetty-proxy:12.1.x
  11. Add Gradle or Maven dependency org.eclipse.jetty:jetty-xml:12.1.x
  12. Add wiremock-httpclient-apache5 where its types are used
  13. Move WireMock types to their 4.x packages
  14. Replace WireMock constructors removed in 4.x
  15. Replace WireMock setter calls with transform()
  16. Drop @Override from removeLast() in custom WireMock request journal stores
  17. Migrate the uuid field in WireMock stub mapping files to id
  18. Preserve the UTF-8 default of ContentTypeHeader.charset()
  19. Migrate RequestMethod.isOneOf to the matcher it became
  20. Change method name com.github.tomakehurst.wiremock.stubbing.StubMapping getUuid() to getId
  21. Change method name com.github.tomakehurst.wiremock.http.RequestMethod value() to getName
  22. Change method name com.github.tomakehurst.wiremock.matching.RequestPattern getMatcher() to getInlineCustomMatcher