Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to migrate `ResponseTemplateTransformer(false)` into WireMock version 3 - Java code

Tags:

wiremock

Being on WireMock version 2, I had the following snippet in some test code, which has been meant to instantiate the WireMockConfig object:

com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig().dynamicPort().extensions(new ResponseTemplateTransformer(false))

The idea has been not to have any specific response transformations.

After upgrading WireMock dependency to version 3, I realised the constructor on class ResponseTemplateTransformer which has been accepting only a boolean, has been disappeared. Looks like there is no good migration guide available online or I did not find it. So I will post what I did to hopefully save some one's time.

like image 727
msd.salehi Avatar asked Apr 25 '26 02:04

msd.salehi


1 Answers

So the answer to me was:

In order to have no response transformations active, do not make yourself tired searching for a new constructor equivalent to ResponseTemplateTransformer(false).

Just ignore calling the extensions builder-method on WireMockConfiguration for passing the ResponseTemplateTransformer. You do not need a Transformer here:

com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig().dynamicPort();

I hope I'm not missing something here as I'm not that much into WireMock.

like image 150
msd.salehi Avatar answered May 01 '26 03:05

msd.salehi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!