如何在 junit5 的以下代码中模拟 whenComplete 的兼容未来的异常

how to mock an exception for compatable future for whenComplete in the below code in junit5

提问人:purvi ijantkar 提问时间:11/8/2023 更新时间:11/8/2023 访问量:16

问:

以下是在 mqtt broker 上发布消息的代码:

           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  ")
          });
spring-boot mqtt testcontainers-junit5

评论


答: 暂无答案