JsonNodeHashCodeFunction implements Function<JsonNode, Integer> { @Override public Integer apply(JsonNode node) { return Optional.of(node).filter(n -> !n.isMissingNode()).map(Objects::hashCode).orElse(random.nextInt()); }  @Override Integer apply(JsonNode node);  }
@Test public void randomOnMissingNode() { assertThat(fn.apply(MissingNode.getInstance()), is(RANDOM_VALUE)); }
@Test public void nodeHashCode() throws Exception { JsonNode node = new ObjectMapper().readTree("{\"a\":\"b\"}"); assertThat(fn.apply(node), is(node.hashCode())); }
@Test public void nullNodeHashCode() { assertThat(fn.apply(NullNode.getInstance()), is(NullNode.getInstance().hashCode())); }