Package org.apache.wink.json4j

Examples of org.apache.wink.json4j.JSONWriter.array()


    public void test_WriteEmptyArray() {
        Exception ex = null;
        try{
            StringWriter w = new StringWriter();
            JSONWriter jWriter = new JSONWriter(w);
            jWriter.array();
            jWriter.endArray();
            String str = w.toString();
            // Verify it parses.
            JSONArray test = new JSONArray(str);
            assertTrue(str.equals("[]"));
View Full Code Here


    public void test_WriteEmptyArrayClose() {
        Exception ex = null;
        try{
            StringWriter w = new StringWriter();
            JSONWriter jWriter = new JSONWriter(w);
            jWriter.array();
            jWriter.close();

            String str = w.toString();
            // Verify it parses.
            JSONArray test = new JSONArray(str);
View Full Code Here

        try{
            StringWriter w = new StringWriter();
            JSONWriter jWriter = new JSONWriter(w);
            jWriter.object();
            jWriter.key("foo");
            jWriter.array();
            jWriter.value(true);
            jWriter.endArray();
            jWriter.endObject();
            jWriter.close();
            String str = w.toString();
View Full Code Here

            jWriter.value("String2");
            jWriter.endObject();

            // Place an array
            jWriter.key("array");
            jWriter.array();
            jWriter.value(1);
            jWriter.value((double)2);
            jWriter.value((short)3);
            jWriter.endArray();
View Full Code Here

    public void test_WriteArrayComplex() {
        Exception ex = null;
        try{
            StringWriter w = new StringWriter();
            JSONWriter jWriter = new JSONWriter(w);
            jWriter.array();
            jWriter.value("String1");
            jWriter.value(false);
            jWriter.value(1);

            // Place an object
View Full Code Here

            jWriter.key("string");
            jWriter.value("String2");
            jWriter.endObject();

            // Place an array
            jWriter.array();
            jWriter.value(1);
            jWriter.value((double)2);
            jWriter.value((short)3);
            jWriter.endArray();
View Full Code Here

    public void test_ArrayKeyFail() {
        Exception ex = null;
        try{
            StringWriter w = new StringWriter();
            JSONWriter jWriter = new JSONWriter(w);
            jWriter.array();

            // This should die.
            jWriter.key("foo");
        }catch(Exception ex1){
            ex = ex1;
View Full Code Here

    public void test_OptsAfterCloseFail() {
        Exception ex = null;
        try{
            StringWriter w = new StringWriter();
            JSONWriter jWriter = new JSONWriter(w);
            jWriter.array();
            jWriter.close();

            // This should die.
            jWriter.endArray();
        }catch(Exception ex1){
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.