Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

eo-cqrs/json-matchers

Repository files navigation

logo

Managed By Self XDSD

EO principles respected here DevOps By Rultor.com We recommend IntelliJ IDEA

mvn maven central javadoc codecov

Hits-of-Code Lines-of-Code PDD status License

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>'
}

JsonEqualTo

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.

How to Contribute

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.