Project architect: @h1alexbel
Hamcrest JSON Matchers.
Motivation. We are not happy dealing with JSON matching and assertions in procedural way.
We offer everything through simple, declarative Hamcrest Matchers.
Principles. These are the design principles behind json-matchers.
How to use. All you need is this (get the latest version here):
Maven:
<dependency>
<groupId>io.github.eo-cqrs</groupId>
<artifactId>json-matchers</artifactId>
<scope>test</scope>
</dependency>
Gradle:
dependencies {
testCompile 'io.github.eo-cqrs:json-matchers:<version>'
}
Simple, Equality Matcher:
new JsonEqualTo(json)
.matches("{\"test\": \"123\"}")
);
final String compare = new SmartJson(
new MutableJson()
.with("test", "123")
.with("test-node", "true")
).pretty();
new JsonEqualTo(json)
.matches(compare);
Each submitted JSON to JsonEqualTo
transformed into pretty string.
Fork repository, make changes, send us a pull request.
We will review your changes and apply them to the master
branch shortly,
provided they don't violate our quality standards. To avoid frustration,
before sending us your pull request please run full Maven build:
$ mvn clean install
You will need Maven 3.8.7+ and Java 17+.
Our rultor image for CI/CD.