Search in sources :

Example 1 with AbstractMqttAttributeClass

use of org.eclipse.smarthome.binding.mqtt.generic.internal.mapping.AbstractMqttAttributeClass 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;
}
Also used : Field(java.lang.reflect.Field) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) SubscribeFieldToMQTTtopic(org.eclipse.smarthome.binding.mqtt.generic.internal.mapping.SubscribeFieldToMQTTtopic) AbstractMqttAttributeClass(org.eclipse.smarthome.binding.mqtt.generic.internal.mapping.AbstractMqttAttributeClass)

Aggregations

Field (java.lang.reflect.Field)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1 AbstractMqttAttributeClass (org.eclipse.smarthome.binding.mqtt.generic.internal.mapping.AbstractMqttAttributeClass)1 SubscribeFieldToMQTTtopic (org.eclipse.smarthome.binding.mqtt.generic.internal.mapping.SubscribeFieldToMQTTtopic)1