Package org.qi4j.api.type

Examples of org.qi4j.api.type.CollectionType


    @Test
    public void givenJsonOfByteListWhenDeserializingExpectCorrectValueOutput()
        throws Exception
    {
        ValueType collectedType = new ValueType( Byte.class );
        CollectionType collectionType = new CollectionType( List.class, collectedType );
        Object json = new JSONArray( byteJson() );
        List<Byte> result = (List<Byte>) new JSONDeserializer( null ).deserialize( json, collectionType );
        ArrayList<Byte> bytes = byteCollection();
        for( int i = 0; i < result.size(); i++ )
        {
View Full Code Here


    @Test
    public void givenJsonOfByteSetWhenDeserializingExpectCorrectValueOutput()
        throws Exception
    {
        ValueType collectedType = new ValueType( Byte.class );
        CollectionType collectionType = new CollectionType( Set.class, collectedType );
        Object json = new JSONArray( byteJson() );
        Set<Byte> result = (Set<Byte>) new JSONDeserializer( null ).deserialize( json, collectionType );
        Set<Byte> bytes = new LinkedHashSet<Byte>( byteCollection() );
        assertEquals( bytes, result );
    }
View Full Code Here

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

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

    @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

TOP

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

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.