Search in sources :

Example 11 with DmxService

use of org.openhab.binding.dmx.DmxService in project openhab1-addons by openhab.

the class DmxSwitchItemTest method switchesOnWhenOnCommandReceived.

@Test
public void switchesOnWhenOnCommandReceived() throws BindingConfigParseException {
    DmxItem item = getValidInstance();
    DmxService service = Mockito.mock(DmxService.class);
    item.processCommand(service, OnOffType.ON);
    Mockito.verify(service).enableChannel(3);
    Mockito.verify(service).enableChannel(4);
}
Also used : DmxService(org.openhab.binding.dmx.DmxService) Test(org.junit.Test)

Example 12 with DmxService

use of org.openhab.binding.dmx.DmxService in project openhab1-addons by openhab.

the class DmxSwitchItemTest method switchesOnToMaxValueWhenOnCommandReceivedAndNoChannelValues.

@Test
public void switchesOnToMaxValueWhenOnCommandReceivedAndNoChannelValues() throws BindingConfigParseException {
    DmxItem item = getValidInstance();
    DmxService service = Mockito.mock(DmxService.class);
    Mockito.when(service.getChannelValue(3)).thenReturn(0);
    Mockito.when(service.getChannelValue(4)).thenReturn(0);
    item.processCommand(service, OnOffType.ON);
    Mockito.verify(service).enableChannel(3);
    Mockito.verify(service).enableChannel(4);
    Mockito.verify(service).setChannelValue(3, 255);
    Mockito.verify(service).setChannelValue(4, 255);
}
Also used : DmxService(org.openhab.binding.dmx.DmxService) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)12 DmxService (org.openhab.binding.dmx.DmxService)12 PercentType (org.openhab.core.library.types.PercentType)5 HSBType (org.openhab.core.library.types.HSBType)3 DecimalType (org.openhab.core.library.types.DecimalType)2 Map (java.util.Map)1 DmxCommand (org.openhab.binding.dmx.internal.cmd.DmxCommand)1