use of com.canoo.dp.impl.remoting.Converters in project dolphin-platform by canoo.
the class LocalDateConverterFactoryTest method testConverterCreation.
@Test
public void testConverterCreation(@Mocked BeanRepository beanRepository) {
// Given
Converters converters = new Converters(beanRepository);
// When
Converter converter = converters.getConverter(LocalDate.class);
// Then
assertNotNull(converter);
}
use of com.canoo.dp.impl.remoting.Converters in project dolphin-platform by canoo.
the class LocalDateConverterFactoryTest method testFactoryFieldType.
@Test
public void testFactoryFieldType(@Mocked BeanRepository beanRepository) {
// Given
Converters converters = new Converters(beanRepository);
// When
int type = converters.getFieldType(LocalDate.class);
// Then
assertEquals(type, ValueFieldTypes.LOCAL_DATE_FIELD_TYPE);
}
use of com.canoo.dp.impl.remoting.Converters in project dolphin-platform by canoo.
the class LocalDateConverterFactoryTest method testNullValues.
@Test
public void testNullValues(@Mocked BeanRepository beanRepository) {
// Given
Converters converters = new Converters(beanRepository);
// When
Converter converter = converters.getConverter(LocalDate.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.dp.impl.remoting.Converters in project dolphin-platform by canoo.
the class LocalDateConverterFactoryTest method testWrongDolphinValues.
@Test(expectedExceptions = ClassCastException.class)
public void testWrongDolphinValues(@Mocked BeanRepository beanRepository) throws ValueConverterException {
// Given
Converters converters = new Converters(beanRepository);
// When
Converter converter = converters.getConverter(LocalDate.class);
// Then
converter.convertFromDolphin(7);
}
use of com.canoo.dp.impl.remoting.Converters in project dolphin-platform by canoo.
the class LocalDateTimeConverterFactoryTest method testBasicConversions.
@Test
public void testBasicConversions(@Mocked BeanRepository beanRepository) {
// Given
Converters converters = new Converters(beanRepository);
// When
Converter converter = converters.getConverter(LocalDateTime.class);
// Then
testReconversion(converter, LocalDateTime.now());
testReconversion(converter, LocalDateTime.now(ZoneId.of(ZoneId.getAvailableZoneIds().iterator().next())));
testReconversion(converter, LocalDateTime.now(ZoneId.of("GMT")));
testReconversion(converter, LocalDateTime.now(ZoneId.of("Z")));
testReconversion(converter, LocalDateTime.now(ZoneId.of("UTC+6")));
}
Aggregations