### Question:
ErrorMap { static Optional<String> tryLookingUp(final JsonNode node, final String... pathElements) { JsonNode current = node; for (String pathElement : pathElements) { current = current.get(pathElement); if (current != null && current.isArray() && current.iterator().hasNext()) { current = current.iterator().next(); } if (current == null) { return Optional.empty(); } } if (current.isObject()) { return Optional.of(current.toString()); } return Optional.of(current.asText()); } private  ErrorMap(); static String from(String rawMsg);  }### Answer:
@Test public void shouldTryToLookupInJson() { final JsonNodeFactory factory = JsonNodeFactory.instance; final ObjectNode obj = factory.objectNode(); obj.set("a", factory.arrayNode().add("b").add("c")); obj.set("x", factory.objectNode().set("y", factory.objectNode().put("z", "!"))); assertThat(ErrorMap.tryLookingUp(obj, "a")).contains("b"); assertThat(ErrorMap.tryLookingUp(obj, "a", "b")).isEmpty(); assertThat(ErrorMap.tryLookingUp(obj, "x", "y")).contains("{\"z\":\"!\"}"); assertThat(ErrorMap.tryLookingUp(obj, "x", "y", "z")).contains("!"); }