Package org.apache.sling.commons.json.util

Examples of org.apache.sling.commons.json.util.DespacedRendering


                );
    }
   
    @Test
    public void testToStringEmpty() throws JSONException {
        final DespacedRendering r = new DespacedRendering(new JSONObject().toString(2));
        r.assertExactMatch("{}");
    }
View Full Code Here


   
    @Test
    public void testToStringSingle() throws JSONException {
        j = new JSONObject();
        j.put("foo", "bar");
        final DespacedRendering r = new DespacedRendering(j.toString(2));
        r.assertExactMatch("{_foo_:_bar_}");
    }
View Full Code Here

        assertEquals("\"\"", JSONObject.quote(""));
    }
   
    @Test
    public void testToJsonArray() throws JSONException {
        final DespacedRendering r = new DespacedRendering("{array:" + j.toJSONArray(j.names()).toString() + "}");
        r.expect("_thisstring_","12","42","true","json.stringhere");
    }
View Full Code Here

    @Test
    public void testWriteJsonArray() throws JSONException {
        final JSONArray a = j.toJSONArray(j.names());
        final StringWriter w = new StringWriter();
        a.write(w);
        final DespacedRendering r = new DespacedRendering("{array:" + w.toString() + "}");
        r.expect("_thisstring_","12","42","true","json.stringhere");
    }
View Full Code Here

   
    @Test
    public void testWrite() throws JSONException {
        final StringWriter w = new StringWriter();
        j.write(w);
        final DespacedRendering r = new DespacedRendering(w.toString());
        r.expect(
                "_long_:42",
                "_string_:_thisstring_",
                "_int_:12",
                "_k0_:{",
                "_name_:_k0_",
View Full Code Here

TOP

Related Classes of org.apache.sling.commons.json.util.DespacedRendering

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.