Search in sources :

Example 16 with Converters

use of com.canoo.dp.impl.remoting.Converters 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);
    }
}
Also used : Converters(com.canoo.dp.impl.remoting.Converters) Converter(com.canoo.platform.remoting.spi.converter.Converter) ValueConverterException(com.canoo.platform.remoting.spi.converter.ValueConverterException) Test(org.testng.annotations.Test)

Example 17 with Converters

use of com.canoo.dp.impl.remoting.Converters in project dolphin-platform by canoo.

the class PeriodeConverterFactoryTest method testConverterCreation.

@Test
public void testConverterCreation(@Mocked BeanRepository beanRepository) {
    // Given
    Converters converters = new Converters(beanRepository);
    // When
    Converter converter = converters.getConverter(Period.class);
    // Then
    assertNotNull(converter);
}
Also used : Converters(com.canoo.dp.impl.remoting.Converters) Converter(com.canoo.platform.remoting.spi.converter.Converter) Test(org.testng.annotations.Test)

Example 18 with Converters

use of com.canoo.dp.impl.remoting.Converters in project dolphin-platform by canoo.

the class PeriodeConverterFactoryTest method testBasicConversions.

@Test
public void testBasicConversions(@Mocked BeanRepository beanRepository) {
    // Given
    Converters converters = new Converters(beanRepository);
    // When
    Converter converter = converters.getConverter(Period.class);
    // Then
    testReconversion(converter, Period.ofDays(7));
    testReconversion(converter, Period.ofYears(700_000_000));
    testReconversion(converter, Period.ofWeeks(70_000_000));
    testReconversion(converter, Period.ZERO);
    testReconversion(converter, Period.ofDays(10_000_000));
}
Also used : Converters(com.canoo.dp.impl.remoting.Converters) Converter(com.canoo.platform.remoting.spi.converter.Converter) Test(org.testng.annotations.Test)

Example 19 with Converters

use of com.canoo.dp.impl.remoting.Converters in project dolphin-platform by canoo.

the class ZonedDateTimeConverterFactoryTest method testFactoryFieldType.

@Test
public void testFactoryFieldType(@Mocked BeanRepository beanRepository) {
    // Given
    Converters converters = new Converters(beanRepository);
    // When
    int type = converters.getFieldType(ZonedDateTime.class);
    // Then
    assertEquals(type, ValueFieldTypes.ZONED_DATE_TIME_FIELD_TYPE);
}
Also used : Converters(com.canoo.dp.impl.remoting.Converters) Test(org.testng.annotations.Test)

Example 20 with Converters

use of com.canoo.dp.impl.remoting.Converters 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);
    }
}
Also used : Converters(com.canoo.dp.impl.remoting.Converters) Converter(com.canoo.platform.remoting.spi.converter.Converter) ValueConverterException(com.canoo.platform.remoting.spi.converter.ValueConverterException) Test(org.testng.annotations.Test)

Aggregations

Converters (com.canoo.dp.impl.remoting.Converters)36 Test (org.testng.annotations.Test)33 Converter (com.canoo.platform.remoting.spi.converter.Converter)28 ValueConverterException (com.canoo.platform.remoting.spi.converter.ValueConverterException)5 BeanBuilder (com.canoo.dp.impl.remoting.BeanBuilder)3 BeanManagerImpl (com.canoo.dp.impl.remoting.BeanManagerImpl)3 ClassRepository (com.canoo.dp.impl.remoting.ClassRepository)3 ClassRepositoryImpl (com.canoo.dp.impl.remoting.ClassRepositoryImpl)3 ListMapper (com.canoo.dp.impl.remoting.ListMapper)3 PresentationModelBuilderFactory (com.canoo.dp.impl.remoting.PresentationModelBuilderFactory)3 ListMapperImpl (com.canoo.dp.impl.remoting.collections.ListMapperImpl)3 RemotingConfiguration (com.canoo.dp.impl.server.config.RemotingConfiguration)2 GarbageCollectionCallback (com.canoo.dp.impl.server.gc.GarbageCollectionCallback)2 GarbageCollector (com.canoo.dp.impl.server.gc.GarbageCollector)2 Instance (com.canoo.dp.impl.server.gc.Instance)2 ServerBeanBuilderImpl (com.canoo.dp.impl.server.model.ServerBeanBuilderImpl)2 ServerPresentationModelBuilderFactory (com.canoo.dp.impl.server.model.ServerPresentationModelBuilderFactory)2 ClientBeanBuilderImpl (com.canoo.dp.impl.client.ClientBeanBuilderImpl)1 ClientPresentationModelBuilderFactory (com.canoo.dp.impl.client.ClientPresentationModelBuilderFactory)1 BeanRepositoryImpl (com.canoo.dp.impl.remoting.BeanRepositoryImpl)1