Package org.apache.wink.json4j

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


    public void test_optDouble() {
        Exception ex = null;

        try {
            JSONObject jObject = new JSONObject("{\"double\":1}");
            assertTrue(jObject.optDouble("double") == 1);
            assertTrue(jObject.optDouble("double2", 2) == 2);
        } catch (Exception ex1) {
            ex = ex1;
            ex.printStackTrace();
        }
View Full Code Here


        Exception ex = null;

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

    public void test_optDoubleNegative() {
        Exception ex = null;

        try {
            JSONObject jObject = new JSONObject("{\"double\":-1}");
            assertTrue(jObject.optDouble("double") == -1);
        } catch (Exception ex1) {
            ex = ex1;
            ex.printStackTrace();
        }
        assertTrue(ex == null);
View Full Code Here

    public void test_optDoubleWithDecimal() {
        Exception ex = null;

        try {
            JSONObject jObject = new JSONObject("{\"double\":100.959}");
            assertTrue(jObject.optDouble("double") == 100.959);
        } catch (Exception ex1) {
            ex = ex1;
            ex.printStackTrace();
        }
        assertTrue(ex == null);
View Full Code Here

    public void test_optDoubleNegativeWithDecimal() {
        Exception ex = null;

        try {
            JSONObject jObject = new JSONObject("{\"double\":-100.959}");
            assertTrue(jObject.optDouble("double") == -100.959);
        } catch (Exception ex1) {
            ex = ex1;
            ex.printStackTrace();
        }
        assertTrue(ex == null);
View Full Code Here

    public void test_optDoubleWithExponential() {
        Exception ex = null;

        try {
            JSONObject jObject = new JSONObject("{\"double\":100959e-3}");
            assertTrue(jObject.optDouble("double") == 100.959);
        } catch (Exception ex1) {
            ex = ex1;
            ex.printStackTrace();
        }
        assertTrue(ex == null);
View Full Code Here

    public void test_optDoubleNegativeWithExponential() {
        Exception ex = null;

        try {
            JSONObject jObject = new JSONObject("{\"double\":-100959e-3}");
            assertTrue(jObject.optDouble("double") == -100.959);
        } 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.