Example usage for org.springframework.messaging.converter CompositeMessageConverter getConverters

List of usage examples for org.springframework.messaging.converter CompositeMessageConverter getConverters

Introduction

In this page you can find the example usage for org.springframework.messaging.converter CompositeMessageConverter getConverters.

Prototype

public List<MessageConverter> getConverters() 

Source Link

Document

Return the underlying list of delegate converters.

Usage

From source file:org.springframework.cloud.stream.config.MessageChannelConfigurerTests.java

@Test
public void testObjectMapperConfig() throws Exception {
    CompositeMessageConverter converters = (CompositeMessageConverter) messageConverterFactory
            .getMessageConverterForType(MimeTypeUtils.APPLICATION_JSON);
    for (MessageConverter converter : converters.getConverters()) {
        DirectFieldAccessor converterAccessor = new DirectFieldAccessor(converter);
        ObjectMapper objectMapper = (ObjectMapper) converterAccessor.getPropertyValue("objectMapper");
        // assert that the ObjectMapper used by the converters is compliant with the
        // Boot configuration
        assertThat(!objectMapper.getSerializationConfig()
                .isEnabled(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS))
                        .withFailMessage("SerializationFeature 'WRITE_DATES_AS_TIMESTAMPS' should be disabled");
        // assert that the globally set bean is used by the converters
        assertThat(objectMapper).isSameAs(this.objectMapper);
    }/*  w ww .j a v a 2s  .com*/
}