eo-cqrs / json-matchers

Hamcrest JSON Matchers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

Hamcrest JSON Matchers

License:MIT License


Languages

Language:Java 100.0%