use of org.springframework.cloud.stream.binder.test.InputDestination in project spring-cloud-stream by spring-cloud.
the class ContentTypeTckTests method pojoToString.
@Test
public void pojoToString() {
ApplicationContext context = new SpringApplicationBuilder(PojoToStringStreamListener.class).web(WebApplicationType.NONE).run("--spring.jmx.enabled=false");
InputDestination source = context.getBean(InputDestination.class);
OutputDestination target = context.getBean(OutputDestination.class);
String jsonPayload = "{\"name\":\"oleg\"}";
source.send(new GenericMessage<>(jsonPayload.getBytes()));
Message<byte[]> outputMessage = target.receive();
assertEquals(MimeTypeUtils.APPLICATION_JSON, outputMessage.getHeaders().get(MessageHeaders.CONTENT_TYPE));
assertEquals("oleg", new String(outputMessage.getPayload(), StandardCharsets.UTF_8));
}
Aggregations