AbstractNode { @Nonnull public List<N> getArrayValues() { checkArray(); List<N> arrayValues = new ArrayList<>(node.size()); for (JsonNode child : node) { arrayValues.add(newNode(child)); } return arrayValues; } AbstractNode(JsonNode node); @Nonnull List<N> getArrayValues(); @Nonnull Map<String, N> getObjectValues(); @Nonnull N getObject(@Nonnull String fieldName); N getObject(@Nonnull String fieldName, @Nullable N def); N getArray(@Nonnull String fieldName); N getArray(@Nonnull String fieldName, @Nullable N def); int getAsInt(@Nonnull String fieldName); int getAsInt(@Nonnull String fieldName, int def); BigInteger getAsBigInt(@Nonnull String fieldName); BigInteger getAsBigInt(@Nonnull String fieldName, BigInteger def); long getAsLong(@Nonnull String fieldName); boolean getAsBoolean(@Nonnull String fieldName); Boolean getAsBoolean(@Nonnull String fieldName, @Nullable Boolean def); @Nonnull String getAsString(@Nonnull String fieldName); String getAsString(@Nonnull String fieldName, @Nullable String def); @Nonnull String getAsString(); boolean isNull(); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode();  }
@Test public void getArrayValues() { AbstractNode<N> node = stringArrayNode("A", "B", "C"); List<String> values = node.getArrayValues().stream(). map(AbstractNode::getAsString). collect(Collectors.toList()); assertThat(values).containsExactly("A", "B", "C"); }
@Test public void getArrayValuesNotAnArray() { assertThatExceptionOfType(NodeProcessingException.class). isThrownBy(() -> emptyNode().getArrayValues()); assertThatExceptionOfType(NodeProcessingException.class). isThrownBy(() -> objectNode(pair("A", "1"), pair("B", "2")).getArrayValues()); assertThatExceptionOfType(NodeProcessingException.class). isThrownBy(() -> stringNode("A").getArrayValues()); }