Package com.alibaba.druid.bvt.utils

Source Code of com.alibaba.druid.bvt.utils.JSONWriterTest

package com.alibaba.druid.bvt.utils;

import java.io.PrintWriter;

import junit.framework.TestCase;

import org.junit.Assert;

import com.alibaba.druid.support.json.JSONWriter;

public class JSONWriterTest extends TestCase {

    public void test_intArray() throws Exception {
        JSONWriter writer = new JSONWriter();
        writer.writeObject(new int[] { 1, 2, 3 });
        Assert.assertEquals("[1,2,3]", writer.toString());
    }

    public void test_throwable() throws Exception {
        JSONWriter writer = new JSONWriter();
        writer.writeObject(new Throwable() {
            public void printStackTrace(PrintWriter s) {
              
            }
        });
        Assert.assertEquals("{\"Class\":\"com.alibaba.druid.bvt.utils.JSONWriterTest$1\",\"Message\":null,\"StackTrace\":\"\"}",
                            writer.toString());
    }
}
TOP

Related Classes of com.alibaba.druid.bvt.utils.JSONWriterTest

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.