### Question:
JsonUtil { public static OptionalLong getLong(final ObjectNode json, final String key) { return getValue(json, key) .filter(jsonNode -> validateType(jsonNode, JsonNodeType.NUMBER)) .filter(JsonUtil::validateLong) .map(JsonNode::asLong) .map(OptionalLong::of) .orElse(OptionalLong.empty()); }  static ObjectNode normalizeKeys(final ObjectNode objectNode); static Optional<String> getValueAsString(final ObjectNode node, final String key); static String getValueAsString(
      final ObjectNode node, final String key, final String defaultValue); static Optional<String> getString(final ObjectNode node, final String key); static String getString(
      final ObjectNode node, final String key, final String defaultValue); static OptionalInt getInt(final ObjectNode node, final String key); static int getInt(final ObjectNode node, final String key, final int defaultValue); static OptionalLong getLong(final ObjectNode json, final String key); static long getLong(final ObjectNode json, final String key, final long defaultValue); static Optional<Boolean> getBoolean(final ObjectNode node, final String key); static boolean getBoolean(
      final ObjectNode node, final String key, final boolean defaultValue); static ObjectNode createEmptyObjectNode(); static ObjectNode objectNodeFromMap(final Map<String, Object> map); static ObjectNode objectNodeFromString(final String jsonData); static ObjectNode objectNodeFromString(
      final String jsonData, final boolean allowComments); static String getJson(final Object objectNode); static String getJson(final Object objectNode, final boolean prettyPrint); static ObjectMapper getObjectMapper(); static Optional<ObjectNode> getObjectNode(final ObjectNode json, final String fieldKey); static Optional<ObjectNode> getObjectNode(
      final ObjectNode json, final String fieldKey, final boolean strict); static Optional<ArrayNode> getArrayNode(final ObjectNode json, final String fieldKey); static Optional<ArrayNode> getArrayNode(
      final ObjectNode json, final String fieldKey, final boolean strict);  }### Answer:
@Test public void getLong_nonExistentKey() { final ObjectNode node = mapper.createObjectNode(); final OptionalLong result = JsonUtil.getLong(node, "test"); assertThat(result).isEmpty(); }
@Test public void getLong_nullValue() { final ObjectNode node = mapper.createObjectNode(); node.set("test", null); final OptionalLong result = JsonUtil.getLong(node, "test"); assertThat(result).isEmpty(); }
@Test public void getLong_validValue() { final ObjectNode node = mapper.createObjectNode(); node.put("test", Long.MAX_VALUE); final OptionalLong result = JsonUtil.getLong(node, "test"); assertThat(result).hasValue(Long.MAX_VALUE); }
@Test public void getLong_nullValue_withDefault() { final long defaultValue = 11; final ObjectNode node = mapper.createObjectNode(); node.set("test", null); final long result = JsonUtil.getLong(node, "test", defaultValue); assertThat(result).isEqualTo(defaultValue); }
@Test public void getLong_nonExistentKey_withDefault() { final long defaultValue = 11; final ObjectNode node = mapper.createObjectNode(); final long result = JsonUtil.getLong(node, "test", defaultValue); assertThat(result).isEqualTo(defaultValue); }
@Test public void getLong_validValue_withDefault() { final ObjectNode node = mapper.createObjectNode(); node.put("test", Long.MAX_VALUE); final long result = JsonUtil.getLong(node, "test", 11); assertThat(result).isEqualTo(Long.MAX_VALUE); }