Add test for empty JSON

This commit is contained in:
Oleg Zhurakousky
2023-11-30 19:01:00 +01:00
parent 863f8093c0
commit 4c66ed77c9

View File

@@ -86,6 +86,22 @@ public class StreamBridgeTests {
System.clearProperty("spring.cloud.function.definition");
}
@Test //
void ensureEmptyPojoIsAllowed() {
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
TestChannelBinderConfiguration.getCompleteConfiguration(EmptyConfiguration.class))
.web(WebApplicationType.NONE).run("--spring.jmx.enabled=false")) {
StreamBridge streamBridge = context.getBean(StreamBridge.class);
OutputDestination outputDestination = context.getBean(OutputDestination.class);
Message<EmptyPojo> message = CloudEventMessageBuilder.withData(new EmptyPojo()).build();
streamBridge.send("fooDestination", message);
Message<byte[]> messageReceived = outputDestination.receive(1000, "fooDestination");
assertThat(new String(messageReceived.getPayload())).isEqualTo("{}");
}
}
@Test // see SCF-985
void ensurePassThruFunctionIsNotPrePostProcessed() {
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
@@ -937,4 +953,8 @@ public class StreamBridgeTests {
}
}
public static class EmptyPojo {
}
}