@Test
public void testOptArray() {

    assertFalse("empty object returns empty object for any key",
            optArray(JsonValue.EMPTY_JSON_OBJECT, "someKey").isPresent());
    assertFalse("object returns empty object for present key with non-object value",
            optArray(key("someKey", obj()).get(), "someKey").isPresent());
    assertFalse("object returns empty object for present key with null value",
            optArray(key("someKey", null).get(), "someKey").isPresent());
    assertTrue("object returns present object for present key with object value",
            optArray(key("someKey", arr("foo", "bar")).get(), "someKey").isPresent());
    assertEquals("object returns correct object value for key with object value",
            "bar",
            optArray(obj()
                    .key("someKey",
                            arr("foo", "bar"))
                    .key("otherKey",
                            arr("bar", "foo")).get(), "someKey")
                    .map(array -> array.getString(1)).orElse(""));
}