hoverfly-java icon indicating copy to clipboard operation
hoverfly-java copied to clipboard

Allow Java API access to the DiffView objects from HoverflyClient.getDiffs()

Open zudljk opened this issue 4 years ago • 0 comments

Is your feature request related to a problem? Please describe. I currently have the problem that when the remote service returns varying, unpredictable values in responses (e.g. timestamps), Hoverfly in DIFF mode will always return a diff because only can do exact matching of actual against expected response bodies. I would like to circumvent this problem by looking at each individual diff in my Java application and check whether it's a real difference or just because some timestamps changed. However given the current Hoverfly-Java this is not possible since the only way to interact with the DIFF API is asserting that there are no diffs.

Describe the solution you'd like Either:

  • Add a public API method in io.specto.hoverfly.junit.core.Hoverfly to give public access to the HoverflyClient::getDiffs method Or:
  • Instead of calling Assert.fail(message.toString()), where message is the combined string of all diff messages, throw a custom subclass of AssertionError that takes the individual expected/actual pairs as arguments and gives access to them to the caller that catches the excepion.

Describe alternatives you've considered I've submitted a feature request to the spectolabs/hoverfly repo as well, as to solve the problem on the hoverfly side.

zudljk avatar Dec 04 '20 11:12 zudljk