@Test void testNodePresent() { assertThatThrownBy(() -> assertThatJson("{\"test1\":2, \"test2\":1}").node("test3").isPresent()) .hasMessage("Different value found in node \"test3\", expected: <node to be present> but was: <missing>."); }
@Test void testPresentWithDescription() { assertThatThrownBy(() -> assertThatJson(jsonSource("{\"test\":1}", "$")).node("test2").isPresent()) .hasMessage("Different value found in node \"$.test2\", expected: <node to be present> but was: <missing>."); }
@Test void isPresentShouldTreatNullAsAbsentWhenSpecified() { assertThatThrownBy(() -> assertThatJson("{\"test1\":2, \"test2\":null}").when(TREATING_NULL_AS_ABSENT).node("test2").isPresent()) .hasMessage("Different value found in node \"test2\", expected: <node to be present> but was: <missing>."); }
@Test void testNodePresentNull() { assertThatJson("{\"test1\":2, \"test2\":null}").node("test2").isPresent(); }
@Test void testNodePresentOk() { assertThatJson("{\"test1\":2, \"test2\":1}").node("test2").isPresent(); }