Package org.qi4j.api.json

Examples of org.qi4j.api.json.JSONObjectSerializer


    {
        ValueType collectedType = new ValueType( Byte.class );
        CollectionType collectionType = new CollectionType( Collection.class, collectedType );

        Collection<Byte> value = byteCollection();
        JSONObjectSerializer serializer = new JSONObjectSerializer();
        serializer.serialize( value, collectionType );
        Object json = serializer.getRoot();
        assertEquals( byteJson(), json.toString() );
    }
View Full Code Here


    {
        ValueType collectedType = new ValueType( Short.class );
        CollectionType collectionType = new CollectionType( Collection.class, collectedType );

        Collection<Short> value = shortCollection();
        JSONObjectSerializer serializer = new JSONObjectSerializer();
        serializer.serialize( value, collectionType );
        Object json = serializer.getRoot();
        assertEquals( shortJson(), json.toString() );
    }
View Full Code Here

    {
        ValueType collectedType = new ValueType( Integer.class );
        CollectionType collectionType = new CollectionType( Collection.class, collectedType );

        Collection<Integer> value = integerCollection();
        JSONObjectSerializer serializer = new JSONObjectSerializer();
        serializer.serialize( value, collectionType );
        Object json = serializer.getRoot();
        assertEquals( integerJson(), json.toString() );
    }
View Full Code Here

    {
        ValueType collectedType = new ValueType( Long.class );
        CollectionType collectionType = new CollectionType( Collection.class, collectedType );

        Collection<Long> value = longCollection();
        JSONObjectSerializer serializer = new JSONObjectSerializer();
        serializer.serialize( value, collectionType );
        Object json = serializer.getRoot();
        assertEquals( longJson(), json.toString() );
    }
View Full Code Here

    {
        ValueType collectedType = new ValueType( Float.class );
        CollectionType collectionType = new CollectionType( Collection.class , collectedType );

        Collection<Float> value = floatCollection();
        JSONObjectSerializer serializer = new JSONObjectSerializer();
        serializer.serialize( value, collectionType );
        Object json = serializer.getRoot();
        assertEquals( floatJson(), json.toString() );
    }
View Full Code Here

    {
        ValueType collectedType = new ValueType( Double.class );
        CollectionType collectionType = new CollectionType( Collection.class, collectedType );

        Collection<Double> value = doubleCollection();
        JSONObjectSerializer serializer = new JSONObjectSerializer();
        serializer.serialize( value, collectionType );
        Object json = serializer.getRoot();
        assertEquals( doubleJson(), json.toString() );
    }
View Full Code Here

    {
        ValueType collectedType = new ValueType( BigInteger.class );
        CollectionType collectionType = new CollectionType( Collection.class, collectedType );

        Collection<BigInteger> value = bigIntegerCollection();
        JSONObjectSerializer serializer = new JSONObjectSerializer();
        serializer.serialize( value, collectionType );
        Object json = serializer.getRoot();
        assertEquals( bigIntegerJson(), json.toString() );
    }
View Full Code Here

    {
        ValueType collectedType = new ValueType( BigDecimal.class );
        CollectionType collectionType = new CollectionType( Collection.class, collectedType );

        Collection<BigDecimal> value = bigDecimalCollection();
        JSONObjectSerializer serializer = new JSONObjectSerializer();
        serializer.serialize( value, collectionType );
        Object json = serializer.getRoot();
        assertEquals( bigDecimalJson(), json.toString() );
    }
View Full Code Here

    @Test
    public void givenLocalDateTypeWhenConvertingToJsonExpectValidString()
        throws Exception
    {
        JSONObjectSerializer serializer = new JSONObjectSerializer();
        serializer.serialize( new LocalDate( "2020-03-04" ), underTest );
        Object value = serializer.getRoot();
        assertEquals( "2020-03-04", value.toString());
    }
View Full Code Here

    @Test
    public void givenLocalDateTypeWhenConvertingToJsonExpectValidString()
        throws Exception
    {
        JSONObjectSerializer serializer = new JSONObjectSerializer();
        serializer.serialize( new LocalDateTime( "2020-03-04T13:23:00", DateTimeZone.UTC ), underTest );
        Object value = serializer.getRoot();
        assertEquals( "2020-03-04T13:23:00.000", value.toString());
    }
View Full Code Here

TOP

Related Classes of org.qi4j.api.json.JSONObjectSerializer

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.