Skip to content

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

Open
@PoorviIjantkar

Description

@PoorviIjantkar

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 ")
});`

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions