'Test mqtt connect void function via fake/in memory implementation
I have the code that listens to a specific topic and a callback in managed in messageInboundHandler class, it works on manual tests but I did not find a good way to test it in automatic test using mockito, is there any fake/in memory mqtt implementation, like h2 for database?
final MqttConnectOptions options = generateMqttConnectOptions(urls, username, password);
final MqttClient mqttClient = generateSubscriberClient(urls.get(0), clientId);
mqttClient.connect(options);
mqttClient.subscribe(topic);
mqttClient.setCallback(messageInboundHandler);
return mqttClient;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
