### Question:
JsonPathUtil { public Optional<String> locateResult(String json, String jsonPath) { final ArrayNode result = JsonPath.using(conf).parse(json).read(jsonPath); if (result.size() == 0) { return Optional.empty(); } else { if (result.get(0).isValueNode()) { return Optional.of(result.get(0).asText()); } else { return Optional.of(result.get(0).toString()); } } } private  JsonPathUtil(); static JsonPathUtil getInstance(); boolean pathExists(String json, String jsonPath); Optional<String> locateResult(String json, String jsonPath); List<String> locateResultList(String json, String jsonPath); List<String> getPathList(String json, String jsonPath);  }### Answer:
@Test public void locateResultTest() { assertEquals("value of hello is found", Optional.of("hello"), JsonPathUtil.getInstance().locateResult(json, "$.test")); assertEquals("nothing returns empty", Optional.empty(), JsonPathUtil.getInstance().locateResult(json, "$.nothing")); }