Skip to content
This repository has been archived by the owner on Aug 9, 2020. It is now read-only.

Extension to mock-http-server that can be used to match http request entities containing JSON content

License

Notifications You must be signed in to change notification settings

kristofa/mock-http-server-json-matcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MockHttpServer JSON matcher

This repo is archived and not maintained anymore. It is still available in read-only mode and can be forked.

<dependency>
    <groupId>com.github.kristofa</groupId>
    <artifactId>mock-http-server-json-matcher</artifactId>
    <version>1.0</version>
    <scope>test</scope>
</dependency>

As of version 4.0, mock-http-server is extended to support matching variable, non deterministic content in http requests.

An example of variable content can be a JSON entity. JSON does not specify a fixed order of properties so when serializing JSON the order of the properties can be different from 1 run to the other.

By default mock-http-server does an exact match of http requests, including entities. By using the JsonMatchingFilter the entity will be interpreted as json and the comparison will also be done for json which means different order of properties will not be considered as a difference anymore.

The JsonMatchingFilter implementation depends on jackson-databind dependency. I did not want to pull this dependency in mock-http-server so I created a separate module.

Similar implementations could be developed for XML or other entity formats.

Changelog

1.0

  • Initial version

About

Extension to mock-http-server that can be used to match http request entities containing JSON content

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages