I'm trying to do some integration testing for my cloud streaming application. One of the main issues I'm observing so far is that the TestChannelBinderConfiguration keeps picking up the configuration specified in src/main/java/resources/application.yml
instead of keeping it as blank (since there is no config file in /src/test/resources/
).
If I delete the application.yml
file or remove all spring-cloud-stream related configuration, the test passes. How can I ensure that the TestChannelBinderConfiguration does not pick up application.yml
file.
@Test
public void echoTransformTest() {
try (ConfigurableApplicationContext context =
new SpringApplicationBuilder(
TestChannelBinderConfiguration.getCompleteConfiguration(DataflowApplication.class))
.properties(new Properties())
.run("--spring.cloud.function.definition=echo")) {
InputDestination source = context.getBean(InputDestination.class);
OutputDestination target = context.getBean(OutputDestination.class);
GenericMessage<byte[]> inputMessage = new GenericMessage<>("hello".getBytes());
source.send(inputMessage);
assertThat(target.receive().getPayload()).isEqualTo("hello".getBytes());
}
}