vbsteven
04/04/2019, 10:02 AMcontext("jsonPath mapping") {
test("maps the assertion to the specified JsonPath expression") {
expectThat(this)
.jsonPath("\$.titles[1]")
.get { textValue() }
.isEqualTo("Protector of Mexico")
}
test("mapping to a JsonPath expression that does not exist results in a missing node") {
expectThat(this)
.jsonPath("date-of-birth")
.get { nodeType }
.isEqualTo(MISSING)
}
test("mapping to an empty JsonPath expression throws the original IllegalArgumentException") {
expectThrows<IllegalArgumentException> {
expectThat(this@test).jsonPath("")
}
}
test("mapping to an invalid JsonPath expression throws the original JsonPathException") {
expectThrows<InvalidPathException> {
expectThat(this@test).jsonPath("..")
}
}
}