Package org.qi4j.api.type

Examples of org.qi4j.api.type.ValueType


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


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

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

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

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

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

    @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

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.