February 2015
Intermediate to advanced
198 pages
4h 17m
English
As we tested the payload, it's fairly easy to test headers. Let's write a header enricher and then a test case to validate it:
<int:header-enricher
input-channel="filteredFeedChannel" output-channel="transformedChannel">
<int:header name="testHeaderKey1" value="testHeaderValue1"/>
<int:header name="testHeaderKey2" value="testHeaderValue2"/>
</int:header-enricher>Headers will be added to any message that is put on filteredFeedChannel. The following code snippet is the test to verify whether these headers are added or not:
import static org.junit.Assert.assertThat; import static org.springframework.integration.test.matcher.HeaderMatcher.hasHeader; import static org.springframework.integration.test.matcher.HeaderMatcher.hasHeaderKey; ...
Read now
Unlock full access