Package org.apache.wink.json4j

Examples of org.apache.wink.json4j.JSONObject.optInt()


    public void test_optInt() {
        Exception ex = null;

        try {
            JSONObject jObject = new JSONObject("{\"int\":1}");
            assertTrue(jObject.optInt("int") == 1);
            assertTrue(jObject.optInt("int2", 2) == 2);
            assertTrue(jObject.optInt("int2") == 0);
        } catch (Exception ex1) {
            ex = ex1;
            ex.printStackTrace();
View Full Code Here


        Exception ex = null;

        try {
            JSONObject jObject = new JSONObject("{\"int\":1}");
            assertTrue(jObject.optInt("int") == 1);
            assertTrue(jObject.optInt("int2", 2) == 2);
            assertTrue(jObject.optInt("int2") == 0);
        } catch (Exception ex1) {
            ex = ex1;
            ex.printStackTrace();
        }
View Full Code Here

        try {
            JSONObject jObject = new JSONObject("{\"int\":1}");
            assertTrue(jObject.optInt("int") == 1);
            assertTrue(jObject.optInt("int2", 2) == 2);
            assertTrue(jObject.optInt("int2") == 0);
        } catch (Exception ex1) {
            ex = ex1;
            ex.printStackTrace();
        }
        assertTrue(ex == null);
View Full Code Here

    public void test_optIntNegative() {
        Exception ex = null;

        try {
            JSONObject jObject = new JSONObject("{\"int\":-1}");
            assertTrue(jObject.optInt("int") == -1);
        } catch (Exception ex1) {
            ex = ex1;
            ex.printStackTrace();
        }
        assertTrue(ex == null);
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.