use of com.canoo.dp.impl.remoting.Converters in project dolphin-platform by canoo.
the class ZonedDateTimeConverterFactoryTest method testWrongBeanValues.
@Test(expectedExceptions = ClassCastException.class)
public void testWrongBeanValues(@Mocked BeanRepository beanRepository) throws ValueConverterException {
// Given
Converters converters = new Converters(beanRepository);
// When
Converter converter = converters.getConverter(ZonedDateTime.class);
// Then
converter.convertToDolphin(7);
}
use of com.canoo.dp.impl.remoting.Converters in project dolphin-platform by canoo.
the class ZonedDateTimeConverterFactoryTest method testBasicConversions.
@Test
public void testBasicConversions(@Mocked BeanRepository beanRepository) {
// Given
Converters converters = new Converters(beanRepository);
// When
Converter converter = converters.getConverter(ZonedDateTime.class);
// Then
testReconversion(converter, ZonedDateTime.now());
testReconversion(converter, ZonedDateTime.now(ZoneId.of(ZoneId.getAvailableZoneIds().iterator().next())));
testReconversion(converter, ZonedDateTime.now(ZoneId.of("GMT")));
testReconversion(converter, ZonedDateTime.now(ZoneId.of("Z")));
testReconversion(converter, ZonedDateTime.now(ZoneId.of("UTC+6")));
}
use of com.canoo.dp.impl.remoting.Converters in project dolphin-platform by canoo.
the class ConverterTest method testDateConversions.
@Test
public void testDateConversions() {
Converters converters = new Converters(null);
Converter converter = converters.getConverter(Date.class);
Date testDate1 = new Date();
checkConversion(converter, testDate1);
Date testDate2 = new Date(0);
checkConversion(converter, testDate2);
Date testDate3 = new Date(Long.MAX_VALUE);
checkConversion(converter, testDate3);
Date testDate4 = null;
checkConversion(converter, testDate4);
// TODO: Not working based on date formate (yyyy), max year is 9999
// Date testDate5 = new Date(Long.MIN_VALUE);
}
use of com.canoo.dp.impl.remoting.Converters in project dolphin-platform by canoo.
the class AbstractDolphinBasedTest method createBeanManager.
protected BeanManager createBeanManager(final ClientModelStore clientModelStore, final BeanRepository beanRepository, final EventDispatcher dispatcher) {
final Converters converters = new Converters(beanRepository);
final PresentationModelBuilderFactory builderFactory = new ClientPresentationModelBuilderFactory(clientModelStore);
final ClassRepository classRepository = new ClassRepositoryImpl(clientModelStore, converters, builderFactory);
final ListMapper listMapper = new ListMapperImpl(clientModelStore, classRepository, beanRepository, builderFactory, dispatcher);
final BeanBuilder beanBuilder = new ClientBeanBuilderImpl(classRepository, beanRepository, listMapper, builderFactory, dispatcher);
return new BeanManagerImpl(beanRepository, beanBuilder);
}
use of com.canoo.dp.impl.remoting.Converters in project dolphin-platform by canoo.
the class ConverterTest method testDoubleConversions.
@Test
public void testDoubleConversions() {
Converters converters = new Converters(null);
Converter converter = converters.getConverter(Double.class);
checkConversion(converter, 2.9d);
checkConversion(converter, null);
checkConversion(converter, 0.0);
checkConversion(converter, Double.MAX_VALUE);
checkConversion(converter, Double.MIN_VALUE);
}
Aggregations