Convert byte[] via text/plain to String

Fix #898

When the payload is `byte[]` ensure that the
String is the String representation, not the
toString() conversion result.
This commit is contained in:
Marius Bogoevici
2017-04-03 18:42:34 -04:00
committed by Ilayaperumal Gopinathan
parent 8f3e448f07
commit 9ea4ff324c
2 changed files with 15 additions and 1 deletions

View File

@@ -63,6 +63,16 @@ public class TextPlainConversionTest {
assertThat(received.getPayload()).isEqualTo("Foo{name='Bar'}");
}
@Test
public void testByteArrayConversionOnOutput() throws Exception {
testProcessor.output().send(MessageBuilder.withPayload("Bar".getBytes()).build());
@SuppressWarnings("unchecked")
Message<?> received = ((TestSupportBinder) binderFactory.getBinder(null, MessageChannel.class))
.messageCollector().forChannel(testProcessor.output()).poll(1, TimeUnit.SECONDS);
assertThat(received).isNotNull();
assertThat(received.getPayload()).isEqualTo("Bar");
}
@Test
public void testTextPlainConversionOnInputAndOutput() throws Exception {
testProcessor.input().send(MessageBuilder.withPayload(new Foo("Bar")).build());