Package org.qi4j.api.type

Examples of org.qi4j.api.type.ValueType


    @Test
    public void givenJsonOfIntegerCollectionWhenDeserializingExpectCorrectValueOutput()
        throws Exception
    {
        ValueType collectedType = new ValueType( Integer.class );
        CollectionType collectionType = new CollectionType( Collection.class, collectedType );
        Object json = new JSONArray( integerJson() );
        List<Integer> result = (List<Integer>) new JSONDeserializer( null ).deserialize( json, collectionType );
        assertEquals( integerCollection(), result );
    }
View Full Code Here


    @Test
    public void givenJsonOfLongCollectionWhenDeserializingExpectCorrectValueOutput()
        throws Exception
    {
        ValueType collectedType = new ValueType( Long.class );
        CollectionType collectionType = new CollectionType( Collection.class, collectedType );
        Object json = new JSONArray( longJson() );
        List<Long> result = (List<Long>) new JSONDeserializer( null ).deserialize( json, collectionType );
        assertEquals( longCollection(), result );
    }
View Full Code Here

    @Test
    public void givenJsonOfFloatCollectionWhenDeserializingExpectCorrectValueOutput()
        throws Exception
    {
        ValueType collectedType = new ValueType( Float.class );
        CollectionType collectionType = new CollectionType( Collection.class, collectedType );
        Object json = new JSONArray( floatJson() );
        List<Float> result = (List<Float>) new JSONDeserializer( null ).deserialize( json, collectionType );
        assertEquals( floatCollection(), result );
    }
View Full Code Here

    @Test
    public void givenJsonOfDoubleCollectionWhenDeserializingExpectCorrectValueOutput()
        throws Exception
    {
        ValueType collectedType = new ValueType( Double.class );
        CollectionType collectionType = new CollectionType( Collection.class, collectedType );
        Object json = new JSONArray( doubleJson() );
        List<Double> result = (List<Double>) new JSONDeserializer( null ).deserialize( json, collectionType );
        assertEquals( doubleCollection(), result );
    }
View Full Code Here

    @Test
    public void givenJsonOfBigIntegerCollectionWhenDeserializingExpectCorrectValueOutput()
        throws Exception
    {
        ValueType collectedType = new ValueType( BigInteger.class );
        CollectionType collectionType = new CollectionType( Collection.class, collectedType );
        Object json = new JSONArray( bigIntegerJson() );
        List<BigInteger> result = (List<BigInteger>) new JSONDeserializer( null ).deserialize( json, collectionType );
        assertEquals( bigIntegerCollection(), result );
    }
View Full Code Here

    @Test
    public void givenJsonOfBigDecimalCollectionWhenDeserializingExpectCorrectValueOutput()
        throws Exception
    {
        ValueType collectedType = new ValueType( BigDecimal.class );
        CollectionType collectionType = new CollectionType( Collection.class, collectedType );
        Object json = new JSONArray( bigDecimalJson() );
        List<BigDecimal> result = (List<BigDecimal>) new JSONDeserializer( null ).deserialize( json, collectionType );
        assertEquals( bigDecimalCollection(), result );
    }
View Full Code Here

    @Test
    public void givenJsonOfBigIntegerCollectionWithQuotesWhenDeserializingExpectCorrectValueOutput()
        throws Exception
    {
        ValueType collectedType = new ValueType( BigInteger.class );
        CollectionType collectionType = new CollectionType( Collection.class, collectedType );
        Object json = new JSONArray( bigIntegerJsonWithQuotes() );
        List<BigDecimal> result = (List<BigDecimal>) new JSONDeserializer( null ).deserialize( json, collectionType );
        assertEquals( bigIntegerCollection(), result );
    }
View Full Code Here

    @Test
    public void givenJsonOfBigDecimalCollectionWithQuotesWhenDeserializingExpectCorrectValueOutput()
        throws Exception
    {
        ValueType collectedType = new ValueType( BigDecimal.class );
        CollectionType collectionType = new CollectionType( Collection.class, collectedType );
        Object json = new JSONArray( bigDecimalJsonWithQuotes() );
        List<BigDecimal> result = (List<BigDecimal>) new JSONDeserializer( null ).deserialize( json, collectionType );
        assertEquals( bigDecimalCollection(), result );
    }
View Full Code Here

    @Test
    public void givenCollectionTypeWithByteAndNullElementWhenSerializingExpectCorrectJsonOutput()
        throws Exception
    {
        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 );
View Full Code Here

    @Test
    public void givenCollectionTypeWithShortAndNullElementWhenSerializingExpectCorrectJsonOutput()
        throws Exception
    {
        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 );
View Full Code Here

TOP

Related Classes of org.qi4j.api.type.ValueType

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.