use of com.canoo.dp.impl.remoting.Converters in project dolphin-platform by canoo.
the class DurationConverterFactoryTest method testFactoryFieldType.
@Test
public void testFactoryFieldType(@Mocked BeanRepository beanRepository) {
// Given
Converters converters = new Converters(beanRepository);
// When
int type = converters.getFieldType(Duration.class);
// Then
assertEquals(type, ValueFieldTypes.DURATION_FIELD_TYPE);
}
use of com.canoo.dp.impl.remoting.Converters in project dolphin-platform by canoo.
the class DurationConverterFactoryTest 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(Duration.class);
// Then
converter.convertFromDolphin(7);
}
use of com.canoo.dp.impl.remoting.Converters in project dolphin-platform by canoo.
the class DurationConverterFactoryTest 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(Duration.class);
// Then
converter.convertToDolphin(7);
}
use of com.canoo.dp.impl.remoting.Converters in project dolphin-platform by canoo.
the class DurationConverterFactoryTest method testNullValues.
@Test
public void testNullValues(@Mocked BeanRepository beanRepository) {
// Given
Converters converters = new Converters(beanRepository);
// When
Converter converter = converters.getConverter(Duration.class);
// Then
try {
assertEquals(converter.convertFromDolphin(null), null);
assertEquals(converter.convertToDolphin(null), null);
} catch (ValueConverterException e) {
fail("Error in conversion");
}
}
use of com.canoo.dp.impl.remoting.Converters in project dolphin-platform by canoo.
the class LocalDateConverterFactoryTest method testBasicConversions.
@Test
public void testBasicConversions(@Mocked BeanRepository beanRepository) {
// Given
Converters converters = new Converters(beanRepository);
// When
Converter converter = converters.getConverter(LocalDate.class);
// Then
testReconversion(converter, LocalDate.now());
testReconversion(converter, LocalDate.now(ZoneId.of(ZoneId.getAvailableZoneIds().iterator().next())));
testReconversion(converter, LocalDate.now(ZoneId.of("GMT")));
testReconversion(converter, LocalDate.now(ZoneId.of("Z")));
testReconversion(converter, LocalDate.now(ZoneId.of("UTC+6")));
testReconversion(converter, LocalDate.now().plusDays(1));
testReconversion(converter, LocalDate.now().minusDays(2));
testReconversion(converter, LocalDate.now().plusWeeks(1));
testReconversion(converter, LocalDate.now().minusWeeks(2));
testReconversion(converter, LocalDate.now().plusYears(1));
testReconversion(converter, LocalDate.now().minusYears(2));
testReconversion(converter, LocalDate.now().plusDays(3).plusWeeks(2).plusYears(1));
}
Aggregations