public class JsonAsserterImpl extends java.lang.Object implements JsonAsserter
| Constructor and Description |
|---|
JsonAsserterImpl(java.lang.Object jsonObject)
Instantiates a new JSONAsserter
|
| Modifier and Type | Method and Description |
|---|---|
JsonAsserter |
and()
Syntactic sugar to allow chaining assertions with a separating and() statement
with(json).assertThat("firstName", is(equalTo("Bobby"))).and().assertThat("lastName", is(equalTo("Ewing")))
|
<T> JsonAsserter |
assertEquals(java.lang.String path,
T expected)
Asserts that object specified by path is equal to the expected value.
|
<T> JsonAsserter |
assertEquals(java.lang.String path,
T expected,
java.lang.String message) |
JsonAsserter |
assertNotDefined(java.lang.String path)
Checks that a path is not defined within a document.
|
JsonAsserter |
assertNotDefined(java.lang.String path,
java.lang.String message) |
<T> JsonAsserter |
assertNotNull(java.lang.String path)
Asserts that object specified by path is NOT null.
|
<T> JsonAsserter |
assertNotNull(java.lang.String path,
java.lang.String message) |
JsonAsserter |
assertNull(java.lang.String path)
Asserts that object specified by path is null.
|
JsonAsserter |
assertNull(java.lang.String path,
java.lang.String message) |
<T> JsonAsserter |
assertThat(java.lang.String path,
org.hamcrest.Matcher<T> matcher)
Asserts that object specified by path satisfies the condition specified by matcher.
|
<T> JsonAsserter |
assertThat(java.lang.String path,
org.hamcrest.Matcher<T> matcher,
java.lang.String message) |
public JsonAsserterImpl(java.lang.Object jsonObject)
jsonObject - the object to make asserts onpublic <T> JsonAsserter assertThat(java.lang.String path, org.hamcrest.Matcher<T> matcher)
with(json).assertThat("items[0].name", equalTo("Bobby"))
.assertThat("items[0].age" , equalTo(24L))
assertThat in interface JsonAsserterT - the static type accepted by the matcherpath - the json path specifying the value being comparedmatcher - an expression, built of Matchers, specifying allowed valuespublic <T> JsonAsserter assertThat(java.lang.String path, org.hamcrest.Matcher<T> matcher, java.lang.String message)
assertThat in interface JsonAsserterT - the static type that should be returned by the pathpath - the json path specifying the value being comparedmatcher - an expression, built of Matchers, specifying allowed valuesmessage - the explanation messagepublic <T> JsonAsserter assertEquals(java.lang.String path, T expected)
assertEquals in interface JsonAsserterT - the static type that should be returned by the pathpath - the json path specifying the value being comparedexpected - the expected valuepublic JsonAsserter assertNotDefined(java.lang.String path)
assertNotDefined in interface JsonAsserterpath - the path to make sure not existspublic JsonAsserter assertNotDefined(java.lang.String path, java.lang.String message)
assertNotDefined in interface JsonAsserterpublic JsonAsserter assertNull(java.lang.String path)
assertNull in interface JsonAsserterpath - the json path specifying the value that should be nullpublic JsonAsserter assertNull(java.lang.String path, java.lang.String message)
assertNull in interface JsonAsserterpublic <T> JsonAsserter assertEquals(java.lang.String path, T expected, java.lang.String message)
assertEquals in interface JsonAsserterpublic <T> JsonAsserter assertNotNull(java.lang.String path)
assertNotNull in interface JsonAsserterpath - the json path specifying the value that should be NOT nullpublic <T> JsonAsserter assertNotNull(java.lang.String path, java.lang.String message)
assertNotNull in interface JsonAsserterpublic JsonAsserter and()
with(json).assertThat("firstName", is(equalTo("Bobby"))).and().assertThat("lastName", is(equalTo("Ewing")))
and in interface JsonAsserter