object JsonDiff extends Logging
- Alphabetic
- By Inheritance
- JsonDiff
- Logging
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
case class
Result(expected: JsonNode, expectedPrettyString: String, actual: JsonNode, actualPrettyString: String) extends Product with Serializable
A JsonDiff result
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
assertDiff[T](expected: T, actual: T, normalizeFn: (JsonNode) ⇒ JsonNode, p: PrintStream): Unit
Asserts that the actual equals the expected.
Asserts that the actual equals the expected. Will throw an AssertionError with details printed to the given PrintStream using the given normalizeFn to normalize the actual contents.
- expected
the expected json
- actual
the actual or received json
- normalizeFn
a function to apply to the actual json in order to "normalize" values.
- p
the PrintStream for reporting details
- Annotations
- @throws( ... )
- Exceptions thrown
AssertionError- when the expected does not match the actual.
-
def
assertDiff[T](expected: T, actual: T, p: PrintStream): Unit
Asserts that the actual equals the expected.
Asserts that the actual equals the expected. Will throw an AssertionError with details printed to the given PrintStream.
- expected
the expected json
- actual
the actual or received json
- p
the PrintStream for reporting details
- Annotations
- @throws( ... )
- Exceptions thrown
AssertionError- when the expected does not match the actual.
-
def
assertDiff[T](expected: T, actual: T, normalizeFn: (JsonNode) ⇒ JsonNode): Unit
Asserts that the actual equals the expected.
Asserts that the actual equals the expected. Will throw an AssertionError with details printed to System.out using the given normalizeFn to normalize the actual contents.
- expected
the expected json
- actual
the actual or received json
- normalizeFn
a function to apply to the actual json in order to "normalize" values.
- Annotations
- @throws( ... )
- Exceptions thrown
AssertionError- when the expected does not match the actual.
-
def
assertDiff[T](expected: T, actual: T): Unit
Asserts that the actual equals the expected.
Asserts that the actual equals the expected. Will throw an AssertionError with details printed to System.out.
- expected
the expected json
- actual
the actual or received json
- Annotations
- @throws( ... )
- Exceptions thrown
AssertionError- when the expected does not match the actual.
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
debug(marker: Marker, message: ⇒ Any, cause: Throwable): Unit
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
debug(message: ⇒ Any, cause: Throwable): Unit
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
debug(marker: Marker, message: ⇒ Any): Unit
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
debug(message: ⇒ Any): Unit
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
debugResult[T](message: ⇒ String)(fn: ⇒ T): T
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
diff[T](expected: T, actual: T, normalizeFn: (JsonNode) ⇒ JsonNode): Option[Result]
Computes the diff for two snippets of json both of expected type
T.Computes the diff for two snippets of json both of expected type
T. If a difference is detected a Result is returned otherwise a None.- expected
the expected json
- actual
the actual or received json
- normalizeFn
a function to apply to the actual json in order to "normalize" values.
- returns
if a difference is detected a Result is returned otherwise a None.
Usage
private def normalize(jsonNode: JsonNode): JsonNode = jsonNode match { case on: ObjectNode => on.put("time", "1970-01-01T00:00:00Z") case _ => jsonNode } val expected = """{"foo": "bar", "time": ""1970-01-01T00:00:00Z"}""" val actual = ??? ({"foo": "bar", "time": ""2021-05-14T00:00:00Z"}) val result: Option[JsonDiff.Result] = JsonDiff.diff(expected, actual, normalize)
-
def
diff[T](expected: T, actual: T): Option[Result]
Computes the diff for two snippets of json both of expected type
T. -
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
error(marker: Marker, message: ⇒ Any, cause: Throwable): Unit
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
error(message: ⇒ Any, cause: Throwable): Unit
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
error(marker: Marker, message: ⇒ Any): Unit
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
error(message: ⇒ Any): Unit
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
errorResult[T](message: ⇒ String)(fn: ⇒ T): T
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
info(marker: Marker, message: ⇒ Any, cause: Throwable): Unit
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
info(message: ⇒ Any, cause: Throwable): Unit
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
info(marker: Marker, message: ⇒ Any): Unit
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
info(message: ⇒ Any): Unit
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
infoResult[T](message: ⇒ String)(fn: ⇒ T): T
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
isDebugEnabled(marker: Marker): Boolean
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
isDebugEnabled: Boolean
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
isErrorEnabled(marker: Marker): Boolean
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
isErrorEnabled: Boolean
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
isInfoEnabled(marker: Marker): Boolean
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
isInfoEnabled: Boolean
- Attributes
- protected[this]
- Definition Classes
- Logging
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isTraceEnabled(marker: Marker): Boolean
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
isTraceEnabled: Boolean
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
isWarnEnabled(marker: Marker): Boolean
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
isWarnEnabled: Boolean
- Attributes
- protected[this]
- Definition Classes
- Logging
-
final
def
logger: Logger
- Attributes
- protected[this]
- Definition Classes
- Logging
-
final
def
loggerName: String
- Attributes
- protected[this]
- Definition Classes
- Logging
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toSortedString(jsonNode: JsonNode): String
Creates a string representation of the given JsonNode with entries sorted alphabetically by key.
Creates a string representation of the given JsonNode with entries sorted alphabetically by key.
- jsonNode
- input JsonNode
- returns
string representation of the JsonNode.
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
trace(marker: Marker, message: ⇒ Any, cause: Throwable): Unit
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
trace(message: ⇒ Any, cause: Throwable): Unit
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
trace(marker: Marker, message: ⇒ Any): Unit
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
trace(message: ⇒ Any): Unit
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
traceResult[T](message: ⇒ String)(fn: ⇒ T): T
- Attributes
- protected[this]
- Definition Classes
- Logging
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
warn(marker: Marker, message: ⇒ Any, cause: Throwable): Unit
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
warn(message: ⇒ Any, cause: Throwable): Unit
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
warn(marker: Marker, message: ⇒ Any): Unit
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
warn(message: ⇒ Any): Unit
- Attributes
- protected[this]
- Definition Classes
- Logging
-
def
warnResult[T](message: ⇒ String)(fn: ⇒ T): T
- Attributes
- protected[this]
- Definition Classes
- Logging