public class JsonPathLibrary extends Object
| Constructor and Description |
|---|
JsonPathLibrary()
Default constructor with no arguments.
|
JsonPathLibrary(String propertiesFile)
Instantiates a library with custom named properties file.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
findJsonElement(String source,
String jsonPath)
Find JSON element by `jsonPath` from the `source` and return its value if found.
|
List<Object> |
findJsonElementList(String source,
String jsonPath)
Find JSON element list by `jsonPath` from the `source` and return its value if found.
|
boolean |
jsonElementShouldMatch(String source,
String jsonPath,
Object value)
Checks if the given value matches the one found by the `jsonPath` from
the `source`.
|
boolean |
jsonShouldBeEqual(String from,
String to)
Checks if the given JSON contents are equal.
|
boolean |
jsonShouldBeEqual(String from,
String to,
boolean useExactMatch)
Checks if the given JSON contents are equal.
|
boolean |
jsonShouldHaveElementCount(String source,
String jsonPath,
Integer count)
Find JSON element by `jsonPath` from the `source` and check if the amount of found elements matches the given `count`.
|
protected void |
loadProperties(String propertiesFile) |
protected String |
loadURI(URI uri) |
protected String |
readSource(String source) |
public JsonPathLibrary()
public JsonPathLibrary(String propertiesFile)
protected void loadProperties(String propertiesFile)
public boolean jsonElementShouldMatch(String source, String jsonPath, Object value) throws Exception
Exceptionpublic boolean jsonShouldBeEqual(String from, String to) throws Exception
Exceptionpublic boolean jsonShouldBeEqual(String from, String to, boolean useExactMatch) throws Exception
Exceptionpublic Object findJsonElement(String source, String jsonPath) throws Exception
Exceptionpublic List<Object> findJsonElementList(String source, String jsonPath) throws Exception
Exceptionpublic boolean jsonShouldHaveElementCount(String source, String jsonPath, Integer count) throws Exception
ExceptionCopyright © 2014. All rights reserved.