use of org.eclipse.smarthome.binding.mqtt.generic.internal.mapping.SubscribeFieldToMQTTtopic in project smarthome by eclipse.
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