@Test
public void testParseFromArray() {

    final JsonArray input = arr().val("foo1:bar1").val("foo2:bar2").val("notvalid").val("foo3:bar3").get();
    final List<Map.Entry<String, String>> expected = Arrays.asList(
            toEntry("foo1", "bar1"),
            toEntry("foo2", "bar2"),
            toEntry("foo3", "bar3")
    );
    final CompletableFuture<Map.Entry<String, Exception>> errorLatch = new CompletableFuture<>();
    final List<Map.Entry<String, String>> parsed = JavaxJson.parseFromArray(input, value -> {
        if (value.contains(":")) {
            final String[] parts = value.split(":", 2);
            return toEntry(parts[0], parts[1]);
        } else {
            throw new IllegalArgumentException("missing colon");
        }
    }, (value, error) -> errorLatch.complete(toEntry(value, error)));
    assertEquals("parse function should work", expected, parsed);
    assertTrue("error latch is done", errorLatch.isDone());
    final Map.Entry<String, Exception> fromLatch = errorLatch.getNow(toEntry("", new Exception("")));
    assertEquals("error latch key is", "notvalid",
            fromLatch.getKey());
    assertEquals("error latch error message is", "missing colon",
            fromLatch.getValue().getMessage());
}