为异步方法编写 Junit 测试用例

问题描述

我有一个异步方法,想编写一个单元测试用例,我将方法粘贴到这里,任何人都可以帮助为此编写测试用例..

......

    public method1(string topic,string msg){
    ...
    client.publishWith().topic(topic).payload(msg.getBytes()).qos(MqttQos.EXACTLY_ONCE).send()
                    .whenComplete((mqtt3Publish,throwable) -> {
                        if (throwable != null) {
                             //Some normal Code
                        } else {
                           
                            //Some normal code
                        }
                    });
    
    ......

}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)