Examples of CField


Examples of com.pardot.rhombus.cobject.CField

        assertEquals(expected, result);
    }

    @Test
    public void typedObjectFromFloatAndDecimal() throws CObjectParseException {
        CField field = new CField("test", "decimal");
        Float jsonValue = 1234.56f;
        BigDecimal expected = BigDecimal.valueOf(jsonValue);

        Object result = JsonUtil.typedObjectFromValueAndField(jsonValue, field);
        assertEquals(expected, result);
View Full Code Here

Examples of com.pardot.rhombus.cobject.CField

        assertEquals(expected, result);
    }

    @Test
    public void typedObjectFromDoubleAndDecimal() throws CObjectParseException {
        CField field = new CField("test", "decimal");
        Double jsonValue = 1234567890.1234567;
        BigDecimal expected = BigDecimal.valueOf(jsonValue);

        Object result = JsonUtil.typedObjectFromValueAndField(jsonValue, field);
        assertEquals(expected, result);
View Full Code Here

Examples of com.pardot.rhombus.cobject.CField

        assertEquals(expected, result);
    }

    @Test
    public void typedObjectFromLegitStringAndDouble() throws CObjectParseException {
        CField field = new CField("test", "double");
        String jsonValue = "1234567890.12345678";
        double expected = 1234567890.12345678;

        Object result = JsonUtil.typedObjectFromValueAndField(jsonValue, field);
        assertEquals(expected, result);
View Full Code Here

Examples of com.pardot.rhombus.cobject.CField

        assertEquals(expected, result);
    }

    @Test(expected=IllegalArgumentException.class)
    public void typedObjectFromCrapStringAndDouble() throws CObjectParseException {
        CField field = new CField("test", "double");
        String jsonValue = "I like ponies";

        JsonUtil.typedObjectFromValueAndField(jsonValue, field);
    }
View Full Code Here

Examples of com.pardot.rhombus.cobject.CField

        JsonUtil.typedObjectFromValueAndField(jsonValue, field);
    }

    @Test
    public void typedObjectFromIntAndDouble() throws CObjectParseException {
        CField field = new CField("test", "double");
        Integer jsonValue = 1234567890;
        double expected = 1234567890;

        Object result = JsonUtil.typedObjectFromValueAndField(jsonValue, field);
        assertEquals(expected, result);
View Full Code Here

Examples of com.pardot.rhombus.cobject.CField

        assertEquals(expected, result);
    }

    @Test
    public void typedObjectFromLongAndDouble() throws CObjectParseException {
        CField field = new CField("test", "double");
        Long jsonValue = 123456789012345L;
        double expected = 123456789012345L;

        Object result = JsonUtil.typedObjectFromValueAndField(jsonValue, field);
        assertEquals(expected, result);
View Full Code Here

Examples of com.pardot.rhombus.cobject.CField

        assertEquals(expected, result);
    }

    @Test
    public void typedObjectFromFloatAndDouble() throws CObjectParseException {
        CField field = new CField("test", "double");
        Float jsonValue = 1234.56f;
        double expected = 1234.56;

        Object result = JsonUtil.typedObjectFromValueAndField(jsonValue, field);
        assertTrue(Double.class.isAssignableFrom(result.getClass()));
View Full Code Here

Examples of com.pardot.rhombus.cobject.CField

        assertEquals(expected, (Double)result, jsonValue * (1E-6));
    }

    @Test
    public void typedObjectFromDoubleAndDouble() throws CObjectParseException {
        CField field = new CField("test", "double");
        Double jsonValue = 1234567890.1234567;

        Object result = JsonUtil.typedObjectFromValueAndField(jsonValue, field);
        assertEquals(jsonValue, result);
    }
View Full Code Here

Examples of com.pardot.rhombus.cobject.CField

        assertEquals(jsonValue, result);
    }

    @Test
     public void typedObjectFromLegitStringAndFloat() throws CObjectParseException {
        CField field = new CField("test", "float");
        String jsonValue = "1234567890.12345678";
        float expected = 1234567940f;

        Object result = JsonUtil.typedObjectFromValueAndField(jsonValue, field);
        assertEquals(expected, result);
View Full Code Here

Examples of com.pardot.rhombus.cobject.CField

        assertEquals(expected, result);
    }

    @Test(expected=IllegalArgumentException.class)
    public void typedObjectFromCrapStringAndFloat() throws CObjectParseException {
        CField field = new CField("test", "float");
        String jsonValue = "I like ponies";

        JsonUtil.typedObjectFromValueAndField(jsonValue, field);
    }
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.