Search in sources :

Example 1 with ItemStateConverterImpl

use of org.eclipse.smarthome.core.internal.items.ItemStateConverterImpl in project smarthome by eclipse.

the class GroupItemTest method setUp.

@Before
public void setUp() {
    initMocks(this);
    registerVolatileStorageService();
    publisher = event -> events.add(event);
    itemRegistry = getService(ItemRegistry.class);
    assertNotNull(itemRegistry);
    registerService(new EventSubscriber() {

        @Override
        public void receive(Event event) {
            events.add(event);
        }

        @Override
        public Set<String> getSubscribedEventTypes() {
            HashSet<String> hs = new HashSet<>();
            hs.add(ItemUpdatedEvent.TYPE);
            return hs;
        }

        @Override
        public EventFilter getEventFilter() {
            return null;
        }
    });
    when(unitProvider.getUnit(Temperature.class)).thenReturn(Units.CELSIUS);
    groupFunctionHelper = new GroupFunctionHelper();
    itemStateConverter = new ItemStateConverterImpl();
    ((ItemStateConverterImpl) itemStateConverter).setUnitProvider(unitProvider);
}
Also used : EventSubscriber(org.eclipse.smarthome.core.events.EventSubscriber) HashSet(java.util.HashSet) Set(java.util.Set) GroupItemStateChangedEvent(org.eclipse.smarthome.core.items.events.GroupItemStateChangedEvent) ItemUpdatedEvent(org.eclipse.smarthome.core.items.events.ItemUpdatedEvent) Event(org.eclipse.smarthome.core.events.Event) GroupFunctionHelper(org.eclipse.smarthome.core.internal.items.GroupFunctionHelper) ItemStateConverterImpl(org.eclipse.smarthome.core.internal.items.ItemStateConverterImpl) EventFilter(org.eclipse.smarthome.core.events.EventFilter) HashSet(java.util.HashSet) Before(org.junit.Before)

Aggregations

HashSet (java.util.HashSet)1 Set (java.util.Set)1 Event (org.eclipse.smarthome.core.events.Event)1 EventFilter (org.eclipse.smarthome.core.events.EventFilter)1 EventSubscriber (org.eclipse.smarthome.core.events.EventSubscriber)1 GroupFunctionHelper (org.eclipse.smarthome.core.internal.items.GroupFunctionHelper)1 ItemStateConverterImpl (org.eclipse.smarthome.core.internal.items.ItemStateConverterImpl)1 GroupItemStateChangedEvent (org.eclipse.smarthome.core.items.events.GroupItemStateChangedEvent)1 ItemUpdatedEvent (org.eclipse.smarthome.core.items.events.ItemUpdatedEvent)1 Before (org.junit.Before)1