### Question:
JsonPathMatchers { public static Matcher<? super Object> hasJsonPath(String jsonPath) { return describedAs("has json path %0", isJson(withJsonPath(jsonPath)), jsonPath); } private  JsonPathMatchers(); static Matcher<? super Object> hasJsonPath(String jsonPath); static Matcher<? super Object> hasJsonPath(String jsonPath, Matcher<T> resultMatcher); static Matcher<? super Object> hasNoJsonPath(String jsonPath); static Matcher<Object> isJson(); static Matcher<Object> isJson(Matcher<? super ReadContext> matcher); static Matcher<String> isJsonString(Matcher<? super ReadContext> matcher); static Matcher<File> isJsonFile(Matcher<? super ReadContext> matcher); static Matcher<? super ReadContext> withJsonPath(String jsonPath, Predicate... filters); static Matcher<? super ReadContext> withJsonPath(JsonPath jsonPath); static Matcher<? super ReadContext> withoutJsonPath(String jsonPath, Predicate... filters); static Matcher<? super ReadContext> withoutJsonPath(JsonPath jsonPath); static Matcher<? super ReadContext> withJsonPath(String jsonPath, Matcher<T> resultMatcher); static Matcher<? super ReadContext> withJsonPath(JsonPath jsonPath, Matcher<T> resultMatcher);  }### Answer:
@Test public void willMatchIndefiniteJsonPathsEvaluatedToEmptyLists() { String json = "{\"items\": []}"; assertThat(json, hasJsonPath("$.items[*].name")); assertThat(json, hasJsonPath("$.items[*]")); assertThat(json, hasJsonPath("$.items[*]", hasSize(0))); }
@Test public void shouldNotMatchInvalidJsonWithPath() { assertThat(INVALID_JSON, not(hasJsonPath("$.path"))); assertThat(new Object(), not(hasJsonPath("$.path"))); assertThat(null, not(hasJsonPath("$.path"))); }
@Test public void shouldNotMatchInvalidJsonWithPathAndValue() { assertThat(INVALID_JSON, not(hasJsonPath("$.path", anything()))); assertThat(new Object(), not(hasJsonPath("$.path", anything()))); assertThat(null, not(hasJsonPath("$.message", anything()))); }
@Test public void shouldMatchJsonPathOnFile() { assertThat(BOOKS_JSON_FILE, hasJsonPath("$.store.name", equalTo("Little Shop"))); }
@Test public void shouldNotMatchJsonPathOnNonExistingFile() { File nonExistingFile = new File("missing-file"); assertThat(nonExistingFile, not(hasJsonPath("$..*", anything()))); }
@Test public void shouldMatchJsonPathOnParsedJsonObject() { Object json = Configuration.defaultConfiguration().jsonProvider().parse(BOOKS_JSON); assertThat(json, hasJsonPath("$.store.name", equalTo("Little Shop"))); }