public interface JsonVerifiable extends IteratingOverArray, JsonReader
| Modifier and Type | Method and Description |
|---|---|
JsonVerifiable |
array()
When in JSON path you iterate over a nameless array
|
JsonVerifiable |
array(Object value)
When you want to assert values in a array with a given name
|
JsonVerifiable |
arrayField()
When you want to compare values of a field in a nameless array
|
JsonVerifiable |
contains(Object value)
Assertion of a field inside an array.
|
JsonVerifiable |
elementWithIndex(int index)
Provides the
JsonVerifiable for the index element of the array |
JsonVerifiable |
field(Object value)
Field assertion.
|
JsonVerifiable |
field(String... fields)
Field assertions.
|
JsonVerifiable |
hasSize(int size)
Checks if the array is of a given size.
|
JsonVerifiable |
isEmpty()
Checks if the array is empty
|
JsonVerifiable |
isEqualTo(Boolean value)
Equality comparison with a Boolean
|
JsonVerifiable |
isEqualTo(Number value)
Equality comparison with a Number
|
JsonVerifiable |
isEqualTo(Object value)
Equality comparison with any object
|
JsonVerifiable |
isEqualTo(String value)
0Equality comparison with String
|
JsonVerifiable |
isInstanceOf(Class clazz)
Checks if instance is the same type
|
JsonVerifiable |
isNull()
Equality comparison to null
|
String |
jsonPath()
Returns current JSON Path expression
|
JsonVerifiable |
matches(String value)
Regex matching for strings
|
void |
matchesJsonPath(String jsonPath)
Checks if the parsed document matches given JSON Path
|
JsonVerifiable |
value()
Syntactic sugar for checking against an array of primitives
|
JsonVerifiable |
withoutThrowingException()
Calling this method will setup the fluent interface to ignore any JSON Path verification
|
isAssertingAValueInArray, isIteratingOverArray, isIteratingOverNamelessArrayreadJsonVerifiable contains(Object value)
JsonVerifiable field(Object value)
JsonVerifiable field(String... fields)
JsonVerifiable array(Object value)
JsonVerifiable arrayField()
JsonVerifiable array()
JsonVerifiable elementWithIndex(int index)
JsonVerifiable for the index element of the arrayJsonVerifiable isEqualTo(String value) throws IllegalStateException
IllegalStateException - - if JSON Path is not matched for the parsed JSONJsonVerifiable isEqualTo(Object value) throws IllegalStateException
IllegalStateException - - if JSON Path is not matched for the parsed JSONJsonVerifiable isEqualTo(Number value) throws IllegalStateException
IllegalStateException - - if JSON Path is not matched for the parsed JSONJsonVerifiable isNull() throws IllegalStateException
IllegalStateException - - if JSON Path is not matched for the parsed JSONJsonVerifiable matches(String value) throws IllegalStateException
IllegalStateException - - if JSON Path is not matched for the parsed JSONJsonVerifiable isEqualTo(Boolean value) throws IllegalStateException
IllegalStateException - - if JSON Path is not matched for the parsed JSONJsonVerifiable isEmpty() throws IllegalStateException
IllegalStateException - - if the result of the JSON Path contains any valuesJsonVerifiable isInstanceOf(Class clazz) throws IllegalStateException
IllegalStateException - - if the object from JSON is not of proper typeJsonVerifiable value()
JsonVerifiable withoutThrowingException()
String jsonPath()
void matchesJsonPath(String jsonPath)
JsonVerifiable hasSize(int size)
String json = '''{ "some_list" : ["name1", "name2"] }'''
assertThat(json).array("some_list").hasSize(2)
Copyright © 2015–2023. All rights reserved.