use of com.canoo.platform.remoting.spi.converter.ValueConverterException in project dolphin-platform by canoo.
the class LocalDateTimeConverterFactoryTest method testReconversion.
private void testReconversion(Converter converter, LocalDateTime time) {
try {
Object dolphinObject = converter.convertToDolphin(time);
assertNotNull(dolphinObject);
TimeZone.setDefault(TimeZone.getTimeZone(ZoneId.of("UTC-3")));
Object reconvertedObject = converter.convertFromDolphin(dolphinObject);
assertNotNull(reconvertedObject);
assertEquals(reconvertedObject.getClass(), LocalDateTime.class);
LocalDateTime reverted = (LocalDateTime) reconvertedObject;
assertEquals(reverted, time);
} catch (ValueConverterException e) {
fail("Error in conversion");
}
}
use of com.canoo.platform.remoting.spi.converter.ValueConverterException in project dolphin-platform by canoo.
the class PeriodeConverterFactoryTest method testNullValues.
@Test
public void testNullValues(@Mocked BeanRepository beanRepository) {
// Given
Converters converters = new Converters(beanRepository);
// When
Converter converter = converters.getConverter(Period.class);
// Then
try {
assertEquals(converter.convertFromDolphin(null), null);
assertEquals(converter.convertToDolphin(null), null);
} catch (ValueConverterException e) {
fail("Error in conversion", e);
}
}
use of com.canoo.platform.remoting.spi.converter.ValueConverterException in project dolphin-platform by canoo.
the class ZonedDateTimeConverterFactoryTest method testReconversion.
private void testReconversion(Converter converter, ZonedDateTime time) {
try {
Object dolphinObject = converter.convertToDolphin(time);
assertNotNull(dolphinObject);
TimeZone.setDefault(TimeZone.getTimeZone(ZoneId.of("UTC-3")));
Object reconvertedObject = converter.convertFromDolphin(dolphinObject);
assertNotNull(reconvertedObject);
assertEquals(reconvertedObject.getClass(), ZonedDateTime.class);
ZonedDateTime reverted = (ZonedDateTime) reconvertedObject;
assertEquals(reverted.withZoneSameInstant(ZoneId.of("UTC")), time.withZoneSameInstant(ZoneId.of("UTC")));
} catch (ValueConverterException e) {
fail("Error in converter", e);
}
}
use of com.canoo.platform.remoting.spi.converter.ValueConverterException in project dolphin-platform by canoo.
the class ZonedDateTimeConverterFactoryTest method testNullValues.
@Test
public void testNullValues(@Mocked BeanRepository beanRepository) {
// Given
Converters converters = new Converters(beanRepository);
// When
Converter converter = converters.getConverter(ZonedDateTime.class);
// Then
try {
assertEquals(converter.convertFromDolphin(null), null);
assertEquals(converter.convertToDolphin(null), null);
} catch (ValueConverterException e) {
fail("Error in conversion", e);
}
}
use of com.canoo.platform.remoting.spi.converter.ValueConverterException in project dolphin-platform by canoo.
the class LocalDateTimeConverterFactoryTest method testNullValues.
@Test
public void testNullValues(@Mocked BeanRepository beanRepository) {
// Given
Converters converters = new Converters(beanRepository);
// When
Converter converter = converters.getConverter(LocalDateTime.class);
// Then
try {
assertEquals(converter.convertFromDolphin(null), null);
assertEquals(converter.convertToDolphin(null), null);
} catch (ValueConverterException e) {
fail("Error in conversion", e);
}
}
Aggregations