use of org.springframework.core.convert.support.DefaultConversionService in project spring-integration by spring-projects.
the class BeanFactoryTypeConverterTests method testDelegateWithTargetUUID.
@Test
public void testDelegateWithTargetUUID() {
DefaultConversionService conversionService = new DefaultConversionService();
BeanFactoryTypeConverter typeConverter = new BeanFactoryTypeConverter(conversionService);
UUID uuid = UUID.randomUUID();
Object converted = typeConverter.convertValue(uuid.toString(), TypeDescriptor.valueOf(String.class), TypeDescriptor.valueOf(UUID.class));
assertEquals(uuid, converted);
}
use of org.springframework.core.convert.support.DefaultConversionService in project spring-integration by spring-projects.
the class BeanFactoryTypeConverterTests method testEditorWithTargetFoo.
@Test
public void testEditorWithTargetFoo() {
DefaultConversionService conversionService = new DefaultConversionService();
final Foo foo = new Foo();
conversionService.addConverter(new Converter<String, Foo>() {
@Override
public Foo convert(String source) {
return foo;
}
});
BeanFactoryTypeConverter typeConverter = new BeanFactoryTypeConverter(conversionService);
UUID uuid = UUID.randomUUID();
Object convertedFoo = typeConverter.convertValue(uuid, TypeDescriptor.valueOf(UUID.class), TypeDescriptor.valueOf(Foo.class));
assertSame(foo, convertedFoo);
}
use of org.springframework.core.convert.support.DefaultConversionService in project spring-integration by spring-projects.
the class BeanFactoryTypeConverterTests method testNullArg.
@Test
public void testNullArg() {
DefaultConversionService conversionService = new DefaultConversionService();
BeanFactoryTypeConverter typeConverter = new BeanFactoryTypeConverter(conversionService);
Object foo = typeConverter.convertValue(null, null, TypeDescriptor.valueOf(Bar.class));
assertNull(foo);
}
use of org.springframework.core.convert.support.DefaultConversionService in project spring-integration by spring-projects.
the class BeanFactoryTypeConverterTests method testEditorWithTargetString.
@Test
public void testEditorWithTargetString() {
DefaultConversionService conversionService = new DefaultConversionService();
BeanFactoryTypeConverter typeConverter = new BeanFactoryTypeConverter(conversionService);
UUID uuid = UUID.randomUUID();
Object foo = typeConverter.convertValue(uuid, TypeDescriptor.valueOf(UUID.class), TypeDescriptor.valueOf(String.class));
assertEquals(uuid.toString(), foo);
}
use of org.springframework.core.convert.support.DefaultConversionService in project spring-integration by spring-projects.
the class DatatypeChannelTests method unsupportedTypeButConversionServiceSupports.
@Test
public void unsupportedTypeButConversionServiceSupports() {
QueueChannel channel = createChannel(Integer.class);
ConversionService conversionService = new DefaultConversionService();
DefaultDatatypeChannelMessageConverter converter = new DefaultDatatypeChannelMessageConverter();
converter.setConversionService(conversionService);
channel.setMessageConverter(converter);
assertTrue(channel.send(new GenericMessage<String>("123")));
}
Aggregations