Package org.apache.wink.json4j.compat

Examples of org.apache.wink.json4j.compat.JSONArray


    public void test_getLong_typeMisMatch() {
        Exception ex = null;
        try {
            System.setProperty("org.apache.wink.common.model.json.factory.impl", "org.apache.wink.json4j.compat.impl.ApacheJSONFactory");
            JSONFactory factory = JSONFactory.newInstance();
            JSONArray jArray = factory.createJSONArray("[\"1\"]");
            assertTrue(jArray.getLong(0) == (long)1);
        } catch (Exception ex1) {
            ex = ex1;
        }
        assertTrue(ex instanceof JSONException);
    }
View Full Code Here


    public void test_getDouble_typeMisMatch() {
        Exception ex = null;
        try {
            System.setProperty("org.apache.wink.common.model.json.factory.impl", "org.apache.wink.json4j.compat.impl.ApacheJSONFactory");
            JSONFactory factory = JSONFactory.newInstance();
            JSONArray jArray = factory.createJSONArray("[\"1\"]");
            assertTrue(jArray.getDouble(0) == 1);
        } catch (Exception ex1) {
            ex = ex1;
        }
        assertTrue(ex instanceof JSONException);
    }
View Full Code Here

    public void test_getInt_typeMisMatch() {
        Exception ex = null;
        try {
            System.setProperty("org.apache.wink.common.model.json.factory.impl", "org.apache.wink.json4j.compat.impl.ApacheJSONFactory");
            JSONFactory factory = JSONFactory.newInstance();
            JSONArray jArray = factory.createJSONArray("[\"1\"]");
            assertTrue(jArray.getLong(0) == (int)1);
        } catch (Exception ex1) {
            ex = ex1;
        }
        assertTrue(ex instanceof JSONException);
    }
View Full Code Here

    public void test_getString_typeMisMatch() {
        Exception ex = null;
        try {
            System.setProperty("org.apache.wink.common.model.json.factory.impl", "org.apache.wink.json4j.compat.impl.ApacheJSONFactory");
            JSONFactory factory = JSONFactory.newInstance();
            JSONArray jArray = factory.createJSONArray("[null]");
            assertTrue(jArray.getString(0) == "null");
        } catch (Exception ex1) {
            ex = ex1;
        }
        assertTrue(ex instanceof JSONException);
    }
View Full Code Here

    public void test_getBoolean_typeMisMatch() {
        Exception ex = null;
        try {
            System.setProperty("org.apache.wink.common.model.json.factory.impl", "org.apache.wink.json4j.compat.impl.ApacheJSONFactory");
            JSONFactory factory = JSONFactory.newInstance();
            JSONArray jArray = factory.createJSONArray("[\"1\"]");
            assertTrue(jArray.getBoolean(0) == true);
        } catch (Exception ex1) {
            ex = ex1;
        }
        System.out.println("Error: " + ex);
        assertTrue(ex instanceof JSONException);
View Full Code Here

    public void test_getLong_typeMisMatchNull() {
        Exception ex = null;
        try {
            System.setProperty("org.apache.wink.common.model.json.factory.impl", "org.apache.wink.json4j.compat.impl.ApacheJSONFactory");
            JSONFactory factory = JSONFactory.newInstance();
            JSONArray jArray = factory.createJSONArray("[null]");
            assertTrue(jArray.getLong(0) == (long)1);
        } catch (Exception ex1) {
            ex = ex1;
        }
        assertTrue(ex instanceof JSONException);
    }
View Full Code Here

    public void test_getInt_typeMisMatchNull() {
        Exception ex = null;
        try {
            System.setProperty("org.apache.wink.common.model.json.factory.impl", "org.apache.wink.json4j.compat.impl.ApacheJSONFactory");
            JSONFactory factory = JSONFactory.newInstance();
            JSONArray jArray = factory.createJSONArray("[null]");
            assertTrue(jArray.getLong(0) == (int)1);
        } catch (Exception ex1) {
            ex = ex1;
        }
        assertTrue(ex instanceof JSONException);
    }
View Full Code Here

    public void test_getDouble_typeMisMatchNull() {
        Exception ex = null;
        try {
            System.setProperty("org.apache.wink.common.model.json.factory.impl", "org.apache.wink.json4j.compat.impl.ApacheJSONFactory");
            JSONFactory factory = JSONFactory.newInstance();
            JSONArray jArray = factory.createJSONArray("[null]");
            assertTrue(jArray.getDouble(0) == (double)1);
        } catch (Exception ex1) {
            ex = ex1;
        }
        assertTrue(ex instanceof JSONException);
    }
View Full Code Here

    public void test_getString_typeMisMatchNull() {
        Exception ex = null;
        try {
            System.setProperty("org.apache.wink.common.model.json.factory.impl", "org.apache.wink.json4j.compat.impl.ApacheJSONFactory");
            JSONFactory factory = JSONFactory.newInstance();
            JSONArray jArray = factory.createJSONArray("[null]");
            assertTrue(jArray.getString(0) == "1");
        } catch (Exception ex1) {
            ex = ex1;
        }
        assertTrue(ex instanceof JSONException);
    }
View Full Code Here

    public void test_getBoolean_typeMisMatchNull() {
        Exception ex = null;
        try {
            System.setProperty("org.apache.wink.common.model.json.factory.impl", "org.apache.wink.json4j.compat.impl.ApacheJSONFactory");
            JSONFactory factory = JSONFactory.newInstance();
            JSONArray jArray = factory.createJSONArray("[null]");
            assertTrue(jArray.getBoolean(0) == true);
        } catch (Exception ex1) {
            ex = ex1;
        }
        assertTrue(ex instanceof JSONException);
    }
View Full Code Here

TOP

Related Classes of org.apache.wink.json4j.compat.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.