use of org.openhab.binding.mqtt.generic.mapping.SubscribeFieldToMQTTtopic in project openhab-addons by openhab.
the class HomieThingHandlerTests method createSubscriberAnswer.
public Object createSubscriberAnswer(InvocationOnMock invocation) {
final AbstractMqttAttributeClass attributes = (AbstractMqttAttributeClass) invocation.getMock();
final ScheduledExecutorService scheduler = (ScheduledExecutorService) invocation.getArguments()[0];
final Field field = (Field) invocation.getArguments()[1];
final String topic = (String) invocation.getArguments()[2];
final boolean mandatory = (boolean) invocation.getArguments()[3];
final SubscribeFieldToMQTTtopic s = spy(new SubscribeFieldToMQTTtopic(scheduler, field, attributes, topic, mandatory));
doReturn(CompletableFuture.completedFuture(true)).when(s).subscribeAndReceive(any(), anyInt());
return s;
}
Aggregations