Examples of optDouble()


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

Examples of org.apache.wink.json4j.JSONObject.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();
        }
        assertTrue(ex == null);
View Full Code Here

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

    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

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

    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

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

    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

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

    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

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

    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

Examples of org.codehaus.jettison.json.JSONObject.optDouble()

        valueAsJson = json.optJSONObject("keyFloat");
        Assert.assertNotNull(valueAsJson);
        Assert.assertTrue(valueAsJson.has(GraphSONTokens.TYPE));
        Assert.assertEquals(GraphSONTokens.TYPE_FLOAT, valueAsJson.optString(GraphSONTokens.TYPE));
        Assert.assertTrue(valueAsJson.has(GraphSONTokens.VALUE));
        Assert.assertEquals(3.3f, (float) valueAsJson.optDouble(GraphSONTokens.VALUE), 0);

        valueAsJson = json.optJSONObject("keyDouble");
        Assert.assertNotNull(valueAsJson);
        Assert.assertTrue(valueAsJson.has(GraphSONTokens.TYPE));
        Assert.assertEquals(GraphSONTokens.TYPE_DOUBLE, valueAsJson.optString(GraphSONTokens.TYPE));
View Full Code Here

Examples of org.codehaus.jettison.json.JSONObject.optDouble()

        valueAsJson = json.optJSONObject("keyDouble");
        Assert.assertNotNull(valueAsJson);
        Assert.assertTrue(valueAsJson.has(GraphSONTokens.TYPE));
        Assert.assertEquals(GraphSONTokens.TYPE_DOUBLE, valueAsJson.optString(GraphSONTokens.TYPE));
        Assert.assertTrue(valueAsJson.has(GraphSONTokens.VALUE));
        Assert.assertEquals(4.4, valueAsJson.optDouble(GraphSONTokens.VALUE), 0);

        valueAsJson = json.optJSONObject("keyShort");
        Assert.assertNotNull(valueAsJson);
        Assert.assertTrue(valueAsJson.has(GraphSONTokens.TYPE));
        Assert.assertEquals(GraphSONTokens.TYPE_SHORT, valueAsJson.optString(GraphSONTokens.TYPE));
View Full Code Here

Examples of org.codehaus.jettison.json.JSONObject.optDouble()

        Assert.assertTrue(json.has(GraphSONTokens._IN_V));
        Assert.assertEquals(2, json.optInt(GraphSONTokens._IN_V));
        Assert.assertTrue(json.has(GraphSONTokens._OUT_V));
        Assert.assertEquals(1, json.optInt(GraphSONTokens._OUT_V));
        Assert.assertTrue(json.has("weight"));
        Assert.assertEquals(0.5d, json.optDouble("weight"), 0.0d);
    }

    @Test
    public void jsonFromElementEdgeCompactIdOnlyAsInclude() throws JSONException {
        Vertex v1 = this.graph.addVertex(1);
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.