JsonUtils { public static boolean jsonEquals(JsonValue a, JsonValue b) { assert a != null; assert b != null; if (a == b) { return true; } JsonType type = a.getType(); if (type != b.getType()) { return false; } switch (type) { case NULL: return true; case BOOLEAN: return a.asBoolean() == b.asBoolean(); case NUMBER: return Double.doubleToRawLongBits(a.asNumber()) == Double .doubleToRawLongBits(b.asNumber()); case STRING: return a.asString().equals(b.asString()); case OBJECT: return jsonObjectEquals((JsonObject) a, (JsonObject) b); case ARRAY: return jsonArrayEquals((JsonArray) a, (JsonArray) b); default: throw new IllegalArgumentException("Unsupported JsonType: " + type); } } 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(expected = AssertionError.class) public void testEquals_firstNull_throws() { JsonUtils.jsonEquals(null, Json.createNull()); }
@Test(expected = AssertionError.class) public void testEquals_secondNull_throws() { JsonUtils.jsonEquals(Json.createNull(), null); }