Add test for empty JSON

This commit is contained in:
Oleg Zhurakousky
2023-11-30 19:01:00 +01:00
parent b5476231ce
commit 116813d1bb

View File

@@ -88,6 +88,22 @@ 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(
@@ -951,4 +967,8 @@ class StreamBridgeTests {
}
}
public static class EmptyPojo {
}
}