Package org.apache.wink.json4j

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


    public void test_WriteEmptyObject() {
        Exception ex = null;
        try{
            StringWriter w = new StringWriter();
            JSONWriter jWriter = new JSONWriter(w);
            jWriter.object();
            jWriter.endObject();
            String str = w.toString();
            // Verify it parses.
            JSONObject test = new JSONObject(str);
            assertTrue(str.equals("{}"));
View Full Code Here


    public void test_WriteEmptyObjectClose() {
        Exception ex = null;
        try{
            StringWriter w = new StringWriter();
            JSONWriter jWriter = new JSONWriter(w);
            jWriter.object();
            jWriter.close();
            String str = w.toString();
            // Verify it parses.
            JSONObject test = new JSONObject(str);
            assertTrue(str.equals("{}"));
View Full Code Here

    public void test_WriteObjectAttrString() {
        Exception ex = null;
        try{
            StringWriter w = new StringWriter();
            JSONWriter jWriter = new JSONWriter(w);
            jWriter.object();
            jWriter.key("foo");
            jWriter.value("bar");
            jWriter.close();
            String str = w.toString();
            // Verify it parses.
View Full Code Here

    public void test_WriteObjectAttrInt() {
        Exception ex = null;
        try{
            StringWriter w = new StringWriter();
            JSONWriter jWriter = new JSONWriter(w);
            jWriter.object();
            jWriter.key("foo");
            jWriter.value(1);
            jWriter.close();
            String str = w.toString();
            // Verify it parses.
View Full Code Here

    public void test_WriteObjectAttrLong() {
        Exception ex = null;
        try{
            StringWriter w = new StringWriter();
            JSONWriter jWriter = new JSONWriter(w);
            jWriter.object();
            jWriter.key("foo");
            jWriter.value((long)1);
            jWriter.close();
            String str = w.toString();
            // Verify it parses.
View Full Code Here

    public void test_WriteObjectAttrShort() {
        Exception ex = null;
        try{
            StringWriter w = new StringWriter();
            JSONWriter jWriter = new JSONWriter(w);
            jWriter.object();
            jWriter.key("foo");
            jWriter.value((short)1);
            jWriter.close();
            String str = w.toString();
            // Verify it parses.
View Full Code Here

    public void test_WriteObjectAttrDouble() {
        Exception ex = null;
        try{
            StringWriter w = new StringWriter();
            JSONWriter jWriter = new JSONWriter(w);
            jWriter.object();
            jWriter.key("foo");
            jWriter.value((double)100.959);
            jWriter.close();
            String str = w.toString();
            // Verify it parses.
View Full Code Here

    public void test_WriteObjectAttrBoolean() {
        Exception ex = null;
        try{
            StringWriter w = new StringWriter();
            JSONWriter jWriter = new JSONWriter(w);
            jWriter.object();
            jWriter.key("foo");
            jWriter.value(true);
            jWriter.close();
            String str = w.toString();
            // Verify it parses.
View Full Code Here

    public void test_WriteObjectAttrObject() {
        Exception ex = null;
        try{
            StringWriter w = new StringWriter();
            JSONWriter jWriter = new JSONWriter(w);
            jWriter.object();
            jWriter.key("foo");
            jWriter.object();
            jWriter.key("foo");
            jWriter.value(true);
            jWriter.endObject();
View Full Code Here

        try{
            StringWriter w = new StringWriter();
            JSONWriter jWriter = new JSONWriter(w);
            jWriter.object();
            jWriter.key("foo");
            jWriter.object();
            jWriter.key("foo");
            jWriter.value(true);
            jWriter.endObject();
            jWriter.endObject();
            jWriter.close();
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.