@Test
public void testWrap() {

    assertSame("null is JsonObject.NULL", JsonObject.NULL, wrap(null));
    assertSame("same true", JsonObject.TRUE, wrap(true));
    assertSame("same false", JsonObject.FALSE, wrap(false));
    final JsonValue value = Json.createArrayBuilder().add("foo").build().get(0);
    assertSame("same value", value, wrap(value));
    assertEquals("equal string value", value, wrap("foo"));
    final JsonObject object = key("foo", "bar").get();
    final JsonObjectConvertible objectible = () -> object;
    assertSame("same value", object, wrap(objectible));
    final JsonArray array = arr().val("foo1").val("foo2").val("foo3").get();
    final JsonArrayConvertible arrayable = () -> array;
    assertSame("same value", array, wrap(arrayable));
    final Calendar now = Calendar.getInstance();
    assertEquals("same date", wrap(ISO8601.format(now)), wrap(now));
    assertEquals("same int",
            10, ((JsonNumber) wrap(10)).intValue());
    assertEquals("same long",
            Integer.MAX_VALUE + 1L, ((JsonNumber) wrap(Integer.MAX_VALUE + 1L)).longValue());
    assertEquals("same double",
            42.0D, ((JsonNumber) wrap(42.0D)).doubleValue(), 1.0D);
    final BigInteger bigInteger = new BigInteger(Long.toString(Integer.MAX_VALUE + 1L));
    assertEquals("same bigint", bigInteger,
            ((JsonNumber) wrap(bigInteger)).bigIntegerValue());
    final BigDecimal bigDecimal = new BigDecimal(Double.toString(Integer.MAX_VALUE + 1L));
    assertEquals("same bigd", bigDecimal,
            ((JsonNumber) wrap(bigDecimal)).bigDecimalValue());
    final float fval = 4.0f;
    assertEquals("same float", Float.valueOf(fval).doubleValue(),
            ((JsonNumber) wrap(fval)).doubleValue(), 1.0D);
    final String[] foos = {"foo"};
    assertEquals("strings should be wrapped inside of a JsonArray",
            Json.createArrayBuilder().add("foo").build(), wrap(foos));
    assertEquals("ints should be wrapped inside of a JsonArray",
            Json.createArrayBuilder().add(42).build(), wrap(new int[]{42}));
    assertEquals("longs should be wrapped inside of a JsonArray",
            Json.createArrayBuilder().add(42L).build(), wrap(new long[]{42L}));
    assertEquals("doubles should be wrapped inside of a JsonArray",
            Json.createArrayBuilder().add(42.0D).build(), wrap(new double[]{42.0D}));
    assertEquals("chars should be wrapped inside of a String",
            Json.createArrayBuilder().add(String.valueOf(new char[]{'c', 'a', 't'})).build().get(0),
            wrap(new char[]{'c', 'a', 't'}));
    final byte[] bytes = "foo".getBytes(StandardCharsets.UTF_8);
    final String bytesEncoded = Base64.getUrlEncoder().encodeToString(bytes);
    assertEquals("bytes should be Base64 encoded in a String",
            Json.createArrayBuilder().add(bytesEncoded).build().get(0),
            wrap(bytes));
    assertEquals("floats should be converted to doubles and wrapped inside of a JsonArray",
            Json.createArrayBuilder().add(4.0D).build(), wrap(new float[]{4.0F}));
    assertEquals("booleans should be wrapped inside of a JsonArray",
            Json.createArrayBuilder().add(true).build(), wrap(new boolean[]{true}));
    final String prefix = "foo";
    final String uri = "http://foo.com/1.0";
    final Map<Integer, JsonNamespace> convMap = Collections
            .singletonMap(5, JsonNamespace.create(prefix, uri));
    assertEquals("convert map to json obj",
            key("5", key(KEY_PREFIX, prefix).key(KEY_URI, uri)).get(), wrap(convMap));
    final List<String> ordinals = Arrays.asList("one", "two", "three");
    assertEquals("collection to json array of wrapped elements",
            Json.createArrayBuilder().add("one").add("two").add("three").build(),
            wrap(ordinals));
    final String otherwiseString = "justAString";
    final Object otherwise = new Object() {
        @Override
        public String toString() {
            return otherwiseString;
        }
    };
    assertEquals("otherwise, just toString the object to a json string",
            Json.createArrayBuilder().add(otherwiseString).build().get(0),
            wrap(otherwise));
}