Don't treat byte[] or collections in a special way.
This commit is contained in:
committed by
Oleg Zhurakousky
parent
0acff2b1d3
commit
b1d9890e0c
@@ -336,6 +336,14 @@ public class BeanFactoryAwareFunctionRegistryTests {
|
||||
assertThat(composed).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void byteArrayNoSpecialHandling() throws Exception {
|
||||
FunctionCatalog catalog = this.configureCatalog(ByteArrayFunction.class);
|
||||
FunctionInvocationWrapper function = catalog.lookup("beanFactoryAwareFunctionRegistryTests.ByteArrayFunction", "application/json");
|
||||
assertThat(function).isNotNull();
|
||||
Message<byte[]> result = (Message<byte[]>) function.apply(MessageBuilder.withPayload("hello".getBytes()).setHeader(MessageHeaders.CONTENT_TYPE, "application/octet-stream").build());
|
||||
assertThat(result.getPayload()).isEqualTo("\"b2xsZWg=\"".getBytes());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
@@ -689,4 +697,19 @@ public class BeanFactoryAwareFunctionRegistryTests {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EnableAutoConfiguration
|
||||
@Configuration
|
||||
@Component
|
||||
public static class ByteArrayFunction implements Function<byte[], byte[]> {
|
||||
|
||||
@Override
|
||||
public byte[] apply(byte[] bytes) {
|
||||
byte[] result = new byte[bytes.length];
|
||||
for (int i = 0; i < bytes.length; i++) {
|
||||
result[i] = bytes[bytes.length - i - 1];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user