Class MockedSender

java.lang.Object
fr.ght1pc9kc.testy.beat.messaging.MockedSender

public class MockedSender extends Object
Mocked sender injectable by the extension WithRabbitMock. This sender allows publishing AMQP messages and RPC requests.

Usage:

 @Test
 void my_test(MockedSender mockedSender) {
     final String request = "test-request";
     final AmqpMessage message = AmqpMessage.of(request.getBytes());

     mockedSender.basicPublish(message).on("my-exchange", "my-routing-key");

     // Verify the tested consumer
 }
 

RPC requests can also be sent:

 @Test
 void my_test(MockedSender mockedSender) {
     final String request = "test-request";
     final AmqpMessage message = AmqpMessage.of(request.getBytes());

     final Mono<Delivery> actualResponse = mockedSender.rpc(message).on("my-exchange", "my-routing-key");

     // Verify the tested consumer and the response
 }