JSON comparison does not work with JsonUnit 3.0.0 and higher
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:
- Use JsonUnit 3.0.0 and higher (I use 3.2.2 version)
- Run MockServer from a JUnit test
- Create an expectation with a JSON body
- Send a request with the same JSON body (it will not match)
Expected behaviour Request with the same JSON body matches