public class JsonAssert extends Object
Reader
similarly to StringModifier and Type | Method and Description |
---|---|
static void |
assertJsonEquals(Object expected,
Object actual)
Compares to JSON documents.
|
static void |
assertJsonEquals(Object expected,
Object actual,
Configuration configuration)
Compares to JSON documents.
|
static void |
assertJsonNodeAbsent(Object actual,
String path)
Fails if node in given path exists.
|
static void |
assertJsonNodePresent(Object actual,
String path)
Fails if node in given does not exist.
|
static void |
assertJsonNotEquals(Object expected,
Object fullJson)
Compares JSONs and fails if they are equal.
|
static void |
assertJsonNotEquals(Object expected,
Object fullJson,
Configuration configuration)
Compares JSONs and fails if they are equal.
|
static void |
assertJsonPartEquals(Object expected,
Object fullJson,
String path)
Compares part of the JSON.
|
static void |
assertJsonPartEquals(Object expected,
Object fullJson,
String path,
Configuration configuration)
Compares part of the JSON.
|
static void |
assertJsonPartNotEquals(Object expected,
Object fullJson,
String path)
Compares part of the JSON and fails if they are equal.
|
static void |
assertJsonPartNotEquals(Object expected,
Object fullJson,
String path,
Configuration configuration)
Compares part of the JSON and fails if they are equal.
|
static void |
assertJsonPartStructureEquals(Object expected,
Object fullJson,
String path)
Compares structure of part of the JSON.
|
static void |
assertJsonStructureEquals(Object expected,
Object actual)
Compares structures of two JSON documents.
|
static String |
getIgnorePlaceholder() |
static BigDecimal |
getTolerance() |
static boolean |
getTreatNullAsAbsent()
Deprecated.
use getOptions().contains(Option.TREATING_NULL_AS_ABSENT)
|
static void |
resetOptions()
Cleans all options.
|
static void |
setIgnorePlaceholder(String ignorePlaceholder)
Set's string that will be ignored in comparison.
|
static void |
setOptions(Option firstOption,
Option... rest)
Sets options changing comparison behavior.
|
static void |
setTolerance(BigDecimal numericComparisonTolerance)
Sets the tolerance for floating number comparison.
|
static void |
setTolerance(double numberComparisonTolerance)
Sets the tolerance for floating number comparison.
|
static void |
setTreatNullAsAbsent(boolean treatNullAsAbsent)
Deprecated.
use setOptions(Option.TREATING_NULL_AS_ABSENT)
|
static Configuration |
when(Option first,
Option... next)
Creates empty configuration and sets options.
|
static Configuration |
withTolerance(BigDecimal tolerance)
Creates empty configuration and sets numerical comparison tolerance.
|
static Configuration |
withTolerance(double tolerance)
Creates empty configuration and sets numerical comparison tolerance.
|
public static void assertJsonEquals(Object expected, Object actual)
AssertionError
if they are different.public static void assertJsonEquals(Object expected, Object actual, Configuration configuration)
AssertionError
if they are different.public static void assertJsonPartEquals(Object expected, Object fullJson, String path)
public static void assertJsonPartEquals(Object expected, Object fullJson, String path, Configuration configuration)
public static void assertJsonNotEquals(Object expected, Object fullJson)
public static void assertJsonNotEquals(Object expected, Object fullJson, Configuration configuration)
public static void assertJsonPartNotEquals(Object expected, Object fullJson, String path)
public static void assertJsonPartNotEquals(Object expected, Object fullJson, String path, Configuration configuration)
public static void assertJsonStructureEquals(Object expected, Object actual)
AssertionError
if they are different.public static void assertJsonPartStructureEquals(Object expected, Object fullJson, String path)
public static void assertJsonNodeAbsent(Object actual, String path)
public static void assertJsonNodePresent(Object actual, String path)
public static void setIgnorePlaceholder(String ignorePlaceholder)
public static String getIgnorePlaceholder()
public static void setTolerance(BigDecimal numericComparisonTolerance)
public static void setTolerance(double numberComparisonTolerance)
public static BigDecimal getTolerance()
@Deprecated public static void setTreatNullAsAbsent(boolean treatNullAsAbsent)
@Deprecated public static boolean getTreatNullAsAbsent()
public static void setOptions(Option firstOption, Option... rest)
Option
Option
public static void resetOptions()
public static Configuration withTolerance(double tolerance)
public static Configuration withTolerance(BigDecimal tolerance)
public static Configuration when(Option first, Option... next)
Copyright © 2016. All Rights Reserved.