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