Is it possible to test StreamBridge with TestChannelBinderConfiguration ? Or there’s something I don’t understand...
I have a test like this :
@ExtendWith(MockitoExtension.class)
@SpringBootTest(classes = { MockConfig.class })
@Import({ TestChannelBinderConfiguration.class })
class NotificationPushEventProducerIntegrationTest {
@Autowired
OutputDestination outputDestination;
@SpyBean
NotificationPushEventProducer producer;
@Captor
ArgumentCaptor<Message<NotificationPushEvent>> msgNotifCaptor;
@Configuration
static class MockConfig {
}
@Test
void testSendingMessage() {
// @formatter:off
NotificationPushEvent notification = NotificationPushEvent.newBuilder()
.build();
StepVerifier.create(this.producer.sendNotificationPush(notification))
.expectNext(true)
.verifyComplete();
Message<?> receive = this.outputDestination.receive(3000, "fact.notification.push");
assertThat(receive).isNotNull();
// @formatter:on
}
}
And inside the producer i do this :
this.streamBridge.send(BINDING_NAME, msgNotif)
The message receive is always null
How can i do to "link" StreamBridge and ChannelBinder ?