Code example for DefaultConversionService

0
public class GenericMessageConverterTests { 
 
	@Rule 
	public final ExpectedException thrown = ExpectedException.none(); 
 
	private final ConversionService conversionService = new DefaultConversionService(); 
	private final GenericMessageConverter converter = new GenericMessageConverter(conversionService); 
 
	@Test 
	public void fromMessageWithConversion() { 
		Message<String> content = MessageBuilder.withPayload("33").build(); 
		assertEquals(33, converter.fromMessage(content, Integer.class)); 
	} 
 
	@Test 
	public void fromMessageNoConverter() { 
		Message<Integer> content = MessageBuilder.withPayload(1234).build(); 
		assertNull("No converter from integer to locale", converter.fromMessage(content, Locale.class)); 
	} 
 
Contextual code suggestions in your IDE  Get Codota for Java