use of org.qi4j.api.type.CollectionType in project qi4j-sdk by Qi4j.
the class AbstractJsonDateFormatTest method givenISO6801DateFormatWhenConvertingFromSerializedStateExpectValidDate.
@Test
public void givenISO6801DateFormatWhenConvertingFromSerializedStateExpectValidDate() throws Exception {
CollectionType collectionType = new CollectionType(List.class, dateType);
List<Date> value = valueDeserializer.deserialize(collectionType, "[\"2009-08-12T14:54:27.895+0800\"]");
assertEquals(new DateTime("2009-08-12T06:54:27.895Z", DateTimeZone.UTC).toDate(), value.get(0));
}
use of org.qi4j.api.type.CollectionType in project qi4j-sdk by Qi4j.
the class AbstractJsonDateFormatTest method givenMicrosoftDateFormatWhenConvertingFromSerializedStateExpectValidDate.
@Test
public void givenMicrosoftDateFormatWhenConvertingFromSerializedStateExpectValidDate() throws Exception {
long tstamp = System.currentTimeMillis();
CollectionType collectionType = new CollectionType(List.class, dateType);
List<Date> value = valueDeserializer.deserialize(collectionType, "[\"/Date(" + tstamp + ")/\"]");
assertEquals(new Date(tstamp), value.get(0));
}
use of org.qi4j.api.type.CollectionType in project qi4j-sdk by Qi4j.
the class AbstractCollectionSerializationTest method givenIterableTypeWithByteAndNullElementWhenSerializingAndDeserializingExpectEquals.
@Test
public void givenIterableTypeWithByteAndNullElementWhenSerializingAndDeserializingExpectEquals() throws Exception {
String output = valueSerialization.serialize(Iterables.iterable(byteCollection().toArray()));
CollectionType collectionType = new CollectionType(List.class, new ValueType(Byte.class));
List<Byte> list = valueSerialization.deserialize(collectionType, output);
assertEquals(byteCollection(), list);
}
use of org.qi4j.api.type.CollectionType in project qi4j-sdk by Qi4j.
the class AbstractCollectionSerializationTest method givenCollectionTypeWithDoubleAndNullElementWhenSerializingExpectCorrectJsonOutput.
@Test
public void givenCollectionTypeWithDoubleAndNullElementWhenSerializingExpectCorrectJsonOutput() throws Exception {
String output = valueSerialization.serialize(doubleCollection());
CollectionType collectionType = new CollectionType(List.class, new ValueType(Double.class));
List<Double> list = valueSerialization.deserialize(collectionType, output);
assertEquals(doubleCollection(), list);
}
use of org.qi4j.api.type.CollectionType in project qi4j-sdk by Qi4j.
the class AbstractCollectionSerializationTest method givenCollectionTypeWithBigIntegerAndNullElementWhenSerializingAndDeserializingExpectEquals.
@Test
public void givenCollectionTypeWithBigIntegerAndNullElementWhenSerializingAndDeserializingExpectEquals() throws Exception {
String output = valueSerialization.serialize(bigIntegerCollection());
CollectionType collectionType = new CollectionType(List.class, new ValueType(BigInteger.class));
List<BigInteger> list = valueSerialization.deserialize(collectionType, output);
assertEquals(bigIntegerCollection(), list);
}
Aggregations