Package org.apache.wink.json4j

Examples of org.apache.wink.json4j.JSONArray


     * Test a basic JSON Array construction and helper 'put' function
     */
    public void test_putBoolean() {
        Exception ex = null;
        try {
            JSONArray jArray = new JSONArray();
            jArray.put(true);
            Boolean b = (Boolean)jArray.get(0);
            assertTrue(b != null);
            assertTrue(b instanceof java.lang.Boolean);
            assertTrue(jArray.getBoolean(0) == true);
        } catch (Exception ex1) {
            ex = ex1;
            ex.printStackTrace();
        }
        assertTrue(ex == null);
View Full Code Here


     * Test a basic JSON Array construction and helper 'put' function
     */
    public void test_putString() {
        Exception ex = null;
        try {
            JSONArray jArray = new JSONArray();
            jArray.put("Hello World.");
            String s = (String)jArray.get(0);
            assertTrue(s != null);
            assertTrue(s instanceof java.lang.String);
            assertTrue(jArray.getString(0).equals("Hello World."));
        } catch (Exception ex1) {
            ex = ex1;
            ex.printStackTrace();
        }
        assertTrue(ex == null);
View Full Code Here

     * Test a basic JSON Array construction and helper 'put' function
     */
    public void test_putNull() {
        Exception ex = null;
        try {
            JSONArray jArray = new JSONArray();
            jArray.put((Object)null);
            String s = (String)jArray.get(0);
            assertTrue(s == null);
        } catch (Exception ex1) {
            ex = ex1;
            ex.printStackTrace();
        }
View Full Code Here

     * Test a basic JSON Array construction and helper 'put' function
     */
    public void test_putJSONObject() {
        Exception ex = null;
        try {
            JSONArray jArray = new JSONArray();
            jArray.put(new JSONObject());
            JSONObject obj = (JSONObject)jArray.get(0);
            assertTrue(obj != null);
            assertTrue(obj instanceof JSONObject);
            assertTrue(((JSONObject)jArray.get(0)).toString().equals("{}"));
        } catch (Exception ex1) {
            ex = ex1;
            ex.printStackTrace();
        }
        assertTrue(ex == null);
View Full Code Here

     * Test a basic JSON Array construction and helper 'put' function
     */
    public void test_putJSONArray() {
        Exception ex = null;
        try {
            JSONArray jArray = new JSONArray();
            jArray.put(new JSONArray());
            JSONArray obj = (JSONArray)jArray.get(0);
            assertTrue(obj != null);
            assertTrue(obj instanceof JSONArray);
            assertTrue(((JSONArray)jArray.get(0)).toString().equals("[]"));
        } catch (Exception ex1) {
            ex = ex1;
View Full Code Here

     * Test a basic JSON Array construction and helper 'get' function
     */
    public void test_getLong() {
        Exception ex = null;
        try {
            JSONArray jArray = new JSONArray("[1]");
            assertTrue(jArray.getLong(0) == (long)1);
        } catch (Exception ex1) {
            ex = ex1;
            ex.printStackTrace();
        }
        assertTrue(ex == null);
View Full Code Here

     * Test a basic JSON Array construction and helper 'get' function
     */
    public void test_getLongNgative() {
        Exception ex = null;
        try {
            JSONArray jArray = new JSONArray("[-1]");
            assertTrue(jArray.getLong(0) == (long)-1);
        } catch (Exception ex1) {
            ex = ex1;
            ex.printStackTrace();
        }
        assertTrue(ex == null);
View Full Code Here

     * Test a basic JSON Array construction and helper 'get' function
     */
    public void test_getInt() {
        Exception ex = null;
        try {
            JSONArray jArray = new JSONArray("[1]");
            assertTrue(jArray.getInt(0) == 1);
        } catch (Exception ex1) {
            ex = ex1;
            ex.printStackTrace();
        }
        assertTrue(ex == null);
View Full Code Here

     * Test a basic JSON Array construction and helper 'get' function
     */
    public void test_getIntNegative() {
        Exception ex = null;
        try {
            JSONArray jArray = new JSONArray("[-1]");
            assertTrue(jArray.getInt(0) == -1);
        } catch (Exception ex1) {
            ex = ex1;
            ex.printStackTrace();
        }
        assertTrue(ex == null);
View Full Code Here

     * Test a basic JSON Array construction and helper 'get' function
     */
    public void test_getDouble() {
        Exception ex = null;
        try {
            JSONArray jArray = new JSONArray("[1]");
            assertTrue(jArray.getDouble(0) == (double)1);
        } catch (Exception ex1) {
            ex = ex1;
            ex.printStackTrace();
        }
        assertTrue(ex == null);
View Full Code Here

TOP

Related Classes of org.apache.wink.json4j.JSONArray

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.