-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Motivating test case:
import static org.jsonbuddy.asserts.JsonAssertions.assertThat;
assertThat(jsonOrder)
.isNotEmpty()
.hasProperty("date")
.hasString("status", "ORDERED") // Throws assertion failure if givenName is missing
.object("customer")
.hasNumber("creditLevel", 100);
assertThat(jsonOrder)
.array("tags")
.isNotEmpty()
.strings()
.contains("urgent", "international");
assertThat(jsonOrder)
.array("orderLines")
.contains(new JsonObject().put("productId", 1).put("quantity", 8))
.get(1)
.isNotEmpty()
.hasProperty("productId")
.hasNumber("quantity", 1000);This should be used in:
- JsonGeneratorTest
- JsonBuildTest
See http://joel-costigliola.github.io/assertj/assertj-core-custom-assertions.html for details.
This requires assertj to be a optional dependency instead of a test dependency.