mockserver icon indicating copy to clipboard operation
mockserver copied to clipboard

JSON comparison does not work with JsonUnit 3.0.0 and higher

Open azotcsit opened this issue 2 years ago • 0 comments

Describe the issue MockServer JSON body matching does not work when JsonUnit 3.0.0 and higher is in use. Basically, request matching fails with the following error:

java.lang.NoClassDefFoundError: net/javacrumbs/jsonunit/core/internal/Options

After a small digging, I found out that there was a refactoring made in JsonUnit (https://github.com/lukas-krecan/JsonUnit/pull/634) as a part of which Options class had been moved to another package (which is mentioned on their release notes: https://github.com/lukas-krecan/JsonUnit#300-2023-07-05). Therefore, MockServer is not anymore compatible with JsonUnit 3.0.0+.

Unfortunately, https://mvnrepository.com/artifact/org.mock-server/mockserver-core/5.15.0 suggests that MockServer is compatible with JsonUnit 3.2.2 which is not true.

What you are trying to do I'm just trying to check/match JSON requests sent from a Spring application.

MockServer version 5.15.0

To Reproduce Steps to reproduce the issue:

  1. Use JsonUnit 3.0.0 and higher (I use 3.2.2 version)
  2. Run MockServer from a JUnit test
  3. Create an expectation with a JSON body
  4. Send a request with the same JSON body (it will not match)

Expected behaviour Request with the same JSON body matches

azotcsit avatar Nov 16 '23 21:11 azotcsit