public final class InternalMatcher extends Object
| Modifier and Type | Class and Description |
|---|---|
class |
InternalMatcher.ArrayMatcher
Array assertions
|
| Constructor and Description |
|---|
InternalMatcher(Object actual,
Path path,
String description,
Configuration configuration) |
| Modifier and Type | Method and Description |
|---|---|
Node |
assertType(Node.NodeType type) |
InternalMatcher |
describedAs(String description)
Sets the description of this object.
|
void |
failOnType(Node node,
String expectedType) |
void |
hasSameStructureAs(Object expected)
Compares JSON structure.
|
void |
isAbsent()
Fails if the node exists.
|
InternalMatcher.ArrayMatcher |
isArray()
Fails if the selected JSON is not an Array or is not present.
|
void |
isEqualTo(Object expected) |
void |
isNotEqualTo(Object expected)
Fails if compared documents are equal.
|
void |
isNotNull() |
void |
isNull() |
void |
isObject()
Fails if the selected JSON is not an Object or is not present.
|
void |
isPresent()
Fails if the node is missing.
|
void |
isPresent(String expectedValue) |
void |
isString()
Fails if the selected JSON is not a String or is not present.
|
void |
isStringEqualTo(String expected)
Fails if the selected JSON is not a String or is not present or the value
is not equal to expected value.
|
void |
matches(org.hamcrest.Matcher<?> matcher)
Matches the node using Hamcrest matcher.
|
InternalMatcher |
node(String newPath)
Creates an assert object that only compares given node.
|
InternalMatcher |
whenIgnoringPaths(String... pathsToBeIgnored) |
InternalMatcher |
withDifferenceListener(DifferenceListener differenceListener) |
InternalMatcher |
withIgnorePlaceholder(String ignorePlaceholder)
Sets the placeholder that can be used to ignore values.
|
InternalMatcher |
withMatcher(String matcherName,
org.hamcrest.Matcher<?> matcher)
Adds a internalMatcher to be used in ${json-unit.matches:matcherName} macro.
|
InternalMatcher |
withOptions(Option firstOption,
Option... otherOptions)
Sets options changing comparison behavior.
|
InternalMatcher |
withTolerance(BigDecimal tolerance)
Sets the tolerance for floating number comparison.
|
InternalMatcher |
withTolerance(double tolerance)
Sets the tolerance for floating number comparison.
|
public static final String ACTUAL
public InternalMatcher(Object actual, Path path, String description, Configuration configuration)
public InternalMatcher whenIgnoringPaths(String... pathsToBeIgnored)
public InternalMatcher describedAs(String description)
public InternalMatcher withIgnorePlaceholder(String ignorePlaceholder)
public InternalMatcher withTolerance(double tolerance)
public InternalMatcher withTolerance(BigDecimal tolerance)
public InternalMatcher withMatcher(String matcherName, org.hamcrest.Matcher<?> matcher)
public InternalMatcher withDifferenceListener(DifferenceListener differenceListener)
public InternalMatcher withOptions(Option firstOption, Option... otherOptions)
OptionfirstOption - otherOptions - Optionpublic void isEqualTo(Object expected)
public void isStringEqualTo(String expected)
public void isNotEqualTo(Object expected)
expected - public void hasSameStructureAs(Object expected)
expected - public InternalMatcher node(String newPath)
assertThatJson("{\"root\":{\"test\":[1,2,3]}}").node("root.test[0]").isEqualTo("1");
newPath - public void isAbsent()
public void isPresent()
public void isPresent(String expectedValue)
public InternalMatcher.ArrayMatcher isArray()
public Node assertType(Node.NodeType type)
public void isObject()
public void isString()
public void isNull()
public void isNotNull()
public void matches(org.hamcrest.Matcher<?> matcher)
matcher - Copyright © 2019. All rights reserved.