hivemq-mqtt-client icon indicating copy to clipboard operation
hivemq-mqtt-client copied to clipboard

How to simulate an exception for compatable future ofpublish.send.whenComplete() in the below code in junit5

Open PoorviIjantkar opened this issue 2 years ago • 0 comments

How to simulate an exception for compatable future ofpublish.send.whenComplete() in the below code in junit5 for the below code

I am writing an integration test.How to mock an exception for whenComplete in the below code:

mqtt5Client.publishWith().topic(topicName) .payload(messagePayLoad) .qos(mqttQos) .retain(isRetainedMessage) .send().whenComplete((connAck, exception) -> { if (exception != null) { log.error("Failed publishing the event ") } else log.info("Successfully published the event ") });`

PoorviIjantkar avatar Nov 09 '23 09:11 PoorviIjantkar