Package com.couchbase.client.java.document

Examples of com.couchbase.client.java.document.JsonArrayDocument


    }

    @Test
    public void shouldDecodeEmptyJsonArray() {
        ByteBuf content = Unpooled.copiedBuffer("[]", CharsetUtil.UTF_8);
        JsonArrayDocument decoded = converter.decode("id", content, 0, 0, TranscoderUtils.JSON_COMMON_FLAGS,
            ResponseStatus.SUCCESS);
        assertTrue(decoded.content().isEmpty());
    }
View Full Code Here


    }

    @Test
    public void shouldDecodeObjectWithEmptyArray() {
        ByteBuf content = Unpooled.copiedBuffer("[{}]", CharsetUtil.UTF_8);
        JsonArrayDocument decoded = converter.decode("id", content, 0, 0,
            TranscoderUtils.JSON_COMMON_FLAGS, ResponseStatus.SUCCESS);

        assertFalse(decoded.content().isEmpty());
        assertEquals(1, decoded.content().size());
        assertTrue(decoded.content().getObject(0).isEmpty());
    }
View Full Code Here

    @Test
    public void shouldDecodeMixedJsonValues() throws Exception {
        ByteBuf content = Unpooled.copiedBuffer("[\"Hello World\",1,9223372036854775807,11.3322,true]",
            CharsetUtil.UTF_8);
        JsonArrayDocument decoded = converter.decode("id", content, 0, 0, TranscoderUtils.JSON_COMMON_FLAGS,
            ResponseStatus.SUCCESS);
        JsonArray found = decoded.content();

        assertFalse(found.isEmpty());
        assertEquals(5, found.size());
        assertEquals(true, found.getBoolean(4));
        assertEquals(1, (int) found.getInt(1));
View Full Code Here


    @Test
    public void shouldReleaseBufferWhenDecoded() {
        ByteBuf content = Unpooled.copiedBuffer("[]", CharsetUtil.UTF_8);
        JsonArrayDocument decoded = converter.decode("id", content, 0, 0, TranscoderUtils.JSON_COMMON_FLAGS,
            ResponseStatus.SUCCESS);
        assertEquals(0, content.refCnt());
    }
View Full Code Here

TOP

Related Classes of com.couchbase.client.java.document.JsonArrayDocument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.