Search in sources :

Example 1 with StaticHeaderValueMessageProcessor

use of org.springframework.integration.transformer.support.StaticHeaderValueMessageProcessor in project spring-integration by spring-projects.

the class MethodInvokingHeaderEnricherTests method overwriteId.

@Test
public void overwriteId() {
    HeaderEnricher enricher = new HeaderEnricher(Collections.singletonMap(MessageHeaders.ID, new StaticHeaderValueMessageProcessor<>("foo")));
    try {
        enricher.afterPropertiesSet();
        fail("BeanInitializationException expected");
    } catch (Exception e) {
        assertThat(e, instanceOf(BeanInitializationException.class));
        assertThat(e.getMessage(), containsString("HeaderEnricher cannot override 'id' and 'timestamp' read-only headers."));
    }
}
Also used : StaticHeaderValueMessageProcessor(org.springframework.integration.transformer.support.StaticHeaderValueMessageProcessor) HeaderEnricher(org.springframework.integration.transformer.HeaderEnricher) BeanInitializationException(org.springframework.beans.factory.BeanInitializationException) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 BeanInitializationException (org.springframework.beans.factory.BeanInitializationException)1 HeaderEnricher (org.springframework.integration.transformer.HeaderEnricher)1 StaticHeaderValueMessageProcessor (org.springframework.integration.transformer.support.StaticHeaderValueMessageProcessor)1