Replies: 1 comment
|
You can still unit-test the nack callback by retrieving the emitted message and invoking it directly: InMemorySink<MyPayload> sink = connector.sink("my-out-channel");
await().untilAsserted(() ->
assertThat(sink.received()).hasSize(1)
);
Message<MyPayload> message = sink.received().get(0);
Throwable failure = new IllegalStateException("simulated broker failure");
CompletionStage<Void> nackResult = message.nack(failure);
assertThatThrownBy(() -> nackResult.toCompletableFuture().join())
.isInstanceOf(CompletionException.class)
.hasCauseInstanceOf(MyWrappedException.class);This tests the callback registered through The Also note that The behavior above follows directly from the current |
Uh oh!
There was an error while loading. Please reload this page.
Hi there,
I am trying to test the handling of NACK in my Outgoing Channel Emitter.
So I am injecting and using an Emitter like that:
Could someone suggest a way to mock/simulate the Connector (InMemoryConnector or a mock wired by other means) nacking the Message so I can test the handling of the nack?
Also, what will happen with the CompletableFuture returned by the nack-function?
It is a quarkus project with Kafka, JUnit and Mockito.
Thanks in advance.
All reactions