JsonUtils { public static Collector<JsonValue, JsonArray, JsonArray> asArray() { return new JsonArrayCollector(); } private  JsonUtils(); static boolean jsonEquals(JsonValue a, JsonValue b); static Stream<T> stream(JsonArray array); static Stream<JsonObject> objectStream(JsonArray array); static DoubleStream numberStream(JsonArray array); static Collector<JsonValue, JsonArray, JsonArray> asArray(); static JsonArray createArray(JsonValue... values); static JsonObject createObject(Map<String, T> map,
            Function<T, JsonValue> itemToJson); static JsonObject beanToJson(Object bean); static JsonArray listToJson(List<?> list); static JsonObject mapToJson(Map<String, ?> map);  }
@Test public void collectEmptyStream() { Stream<JsonValue> jsonValueStream = Stream.empty(); JsonArray a = jsonValueStream.collect(JsonUtils.asArray()); Assert.assertEquals(0, a.length()); }
@Test public void testAsArray() { Stream<JsonValue> stream = JsonUtils.stream(createTestArray1()); JsonArray array = stream.collect(JsonUtils.asArray()); Assert.assertTrue(JsonUtils.jsonEquals(createTestArray1(), array)); }