public class JsonAsserterImpl extends Object implements JsonAsserter
| Constructor and Description |
|---|
JsonAsserterImpl(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(String path,
T expected)
Asserts that object specified by path is equal to the expected value.
|
<T> JsonAsserter |
assertEquals(String path,
T expected,
String message) |
JsonAsserter |
assertNotDefined(String path)
Checks that a path is not defined within a document.
|
JsonAsserter |
assertNotDefined(String path,
String message) |
<T> JsonAsserter |
assertNotNull(String path)
Asserts that object specified by path is NOT null.
|
<T> JsonAsserter |
assertNotNull(String path,
String message) |
JsonAsserter |
assertNull(String path)
Asserts that object specified by path is null.
|
JsonAsserter |
assertNull(String path,
String message) |
<T> JsonAsserter |
assertThat(String path,
org.hamcrest.Matcher<T> matcher)
Asserts that object specified by path satisfies the condition specified by matcher.
|
<T> JsonAsserter |
assertThat(String path,
org.hamcrest.Matcher<T> matcher,
String message) |
public JsonAsserterImpl(Object jsonObject)
jsonObject - the object to make asserts onpublic <T> JsonAsserter assertThat(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(String path, org.hamcrest.Matcher<T> matcher, String message)
assertThat in interface JsonAsserterpublic <T> JsonAsserter assertEquals(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(String path)
assertNotDefined in interface JsonAsserterpath - the path to make sure not existspublic JsonAsserter assertNotDefined(String path, String message)
assertNotDefined in interface JsonAsserterpublic JsonAsserter assertNull(String path)
assertNull in interface JsonAsserterpath - the json path specifying the value that should be nullpublic JsonAsserter assertNull(String path, String message)
assertNull in interface JsonAsserterpublic <T> JsonAsserter assertEquals(String path, T expected, String message)
assertEquals in interface JsonAsserterpublic <T> JsonAsserter assertNotNull(String path)
assertNotNull in interface JsonAsserterpath - the json path specifying the value that should be NOT nullpublic <T> JsonAsserter assertNotNull(String path, String message)
assertNotNull in interface JsonAsserterpublic JsonAsserter and()
with(json).assertThat("firstName", is(equalTo("Bobby"))).and().assertThat("lastName", is(equalTo("Ewing")))
and in interface JsonAsserterCopyright © 2017. All rights reserved.