public class JSONBodyTypeAdapter extends XPathBodyTypeAdapter
| Constructor and Description |
|---|
JSONBodyTypeAdapter(RunnerVariablesProvider variablesProvider,
Config config)
def ctor
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object expected,
Object actual)
Equality check for bodies.
|
protected boolean |
eval(String expr,
String json) |
Object |
parse(String possibleJsContent)
Parses the expected body in the current test.
|
String |
toString(Object obj)
This renders the actual body - expected as a String containing XML - as
HTML to be displayed in the test page.
|
String |
toXmlString(String content) |
checkNoBody, getCharset, setCharsetaddError, fromString, get, getContext, getErrors, set, setContext, toStringpublic JSONBodyTypeAdapter(RunnerVariablesProvider variablesProvider, Config config)
variablesProvider - used for substitutionsconfig - the configprotected boolean eval(String expr, String json)
eval in class XPathBodyTypeAdapterpublic Object parse(String possibleJsContent) throws Exception
XPathBodyTypeAdapter
A body is a String containing XPaths one for each new line. Empty body
would result in an empty List<String>. A body containing the
value no-body is especially treated separately.
parse in class XPathBodyTypeAdapterpossibleJsContent - expected list of xpaths as stringExceptionpublic boolean equals(Object expected, Object actual)
XPathBodyTypeAdapterList<String> of XPaths - as parsed by
XPathBodyTypeAdapter.parse(String ) - to be executed in the
actual body. The check is true if all XPaths executed in the actual body
return a node list not null or empty.
A special case is dedicated to no-body. If the expected body is
no-body, the equality check is true if the actual body returned
by the REST response is empty or null.equals in class XPathBodyTypeAdapterexpected - the expected body, it's a string with XPaths separated by
System.getProperty("line.separator")actual - the body of the REST response returned by the call in the
current test rowTypeAdapterpublic String toString(Object obj)
BodyTypeAdaptertoString in interface fitnesse.slim.ConvertertoString in class BodyTypeAdapterobj - the List<String> actual body, or an empty/null body
rendered as HTMLpublic String toXmlString(String content)
toXmlString in class XPathBodyTypeAdaptercontent - the content of the body response to be XMLified.Copyright © 2017 smartrics. All rights reserved.