Search in sources :

Example 1 with LightwaveRfOnOffCommand

use of org.openhab.binding.lightwaverf.internal.command.LightwaveRfOnOffCommand in project openhab1-addons by openhab.

the class LightwaverfConvertorTest method testConvertFromLightwaveRfMessageOffCommand.

@Test
public void testConvertFromLightwaveRfMessageOffCommand() throws Exception {
    LightwaverfConvertor convertor = new LightwaverfConvertor();
    LightwaveRFCommand command = convertor.convertFromLightwaveRfMessage("010,!R2D3F0");
    LightwaveRFCommand expected = new LightwaveRfOnOffCommand(10, "2", "3", false);
    assertEquals(expected, command);
}
Also used : LightwaveRfOnOffCommand(org.openhab.binding.lightwaverf.internal.command.LightwaveRfOnOffCommand) LightwaveRFCommand(org.openhab.binding.lightwaverf.internal.command.LightwaveRFCommand) Test(org.junit.Test)

Example 2 with LightwaveRfOnOffCommand

use of org.openhab.binding.lightwaverf.internal.command.LightwaveRfOnOffCommand in project openhab1-addons by openhab.

the class LightwaverfConvertorTest method testConvertToLightwaveRfMessageOffCommand.

@Test
public void testConvertToLightwaveRfMessageOffCommand() throws Exception {
    LightwaverfConvertor convertor = new LightwaverfConvertor();
    LightwaveRFCommand command = convertor.convertToLightwaveRfMessage("2", "3", LightwaveRfType.SWITCH, OnOffType.OFF);
    LightwaveRFCommand expected = new LightwaveRfOnOffCommand("200,!R2D3F0");
    assertEquals(expected.getLightwaveRfCommandString(), command.getLightwaveRfCommandString());
}
Also used : LightwaveRfOnOffCommand(org.openhab.binding.lightwaverf.internal.command.LightwaveRfOnOffCommand) LightwaveRFCommand(org.openhab.binding.lightwaverf.internal.command.LightwaveRFCommand) Test(org.junit.Test)

Example 3 with LightwaveRfOnOffCommand

use of org.openhab.binding.lightwaverf.internal.command.LightwaveRfOnOffCommand in project openhab1-addons by openhab.

the class LightwaverfConvertorTest method testConvertToLightwaveRfMessageOnCommand.

@Test
public void testConvertToLightwaveRfMessageOnCommand() throws Exception {
    LightwaverfConvertor convertor = new LightwaverfConvertor();
    LightwaveRFCommand command = convertor.convertToLightwaveRfMessage("2", "3", LightwaveRfType.SWITCH, OnOffType.ON);
    LightwaveRFCommand expected = new LightwaveRfOnOffCommand("200,!R2D3F1");
    assertEquals(expected.getLightwaveRfCommandString(), command.getLightwaveRfCommandString());
}
Also used : LightwaveRfOnOffCommand(org.openhab.binding.lightwaverf.internal.command.LightwaveRfOnOffCommand) LightwaveRFCommand(org.openhab.binding.lightwaverf.internal.command.LightwaveRFCommand) Test(org.junit.Test)

Example 4 with LightwaveRfOnOffCommand

use of org.openhab.binding.lightwaverf.internal.command.LightwaveRfOnOffCommand in project openhab1-addons by openhab.

the class LightwaverfConvertorTest method testConvertFromLightwaveRfMessageOnCommand.

@Test
public void testConvertFromLightwaveRfMessageOnCommand() throws Exception {
    LightwaverfConvertor convertor = new LightwaverfConvertor();
    LightwaveRFCommand command = convertor.convertFromLightwaveRfMessage("010,!R2D3F1");
    LightwaveRFCommand expected = new LightwaveRfOnOffCommand(10, "2", "3", true);
    assertEquals(expected, command);
}
Also used : LightwaveRfOnOffCommand(org.openhab.binding.lightwaverf.internal.command.LightwaveRfOnOffCommand) LightwaveRFCommand(org.openhab.binding.lightwaverf.internal.command.LightwaveRFCommand) Test(org.junit.Test)

Example 5 with LightwaveRfOnOffCommand

use of org.openhab.binding.lightwaverf.internal.command.LightwaveRfOnOffCommand in project openhab1-addons by openhab.

the class LightwaveRfBindingTest method testRoomDeviceMessageRecevied.

@Test
public void testRoomDeviceMessageRecevied() {
    when(mockBindingProvider.getBindingItemsForRoomDevice("2", "3")).thenReturn(Arrays.asList("MySwitch"));
    when(mockBindingProvider.getTypeForItemName("MySwitch")).thenReturn(LightwaveRfType.SWITCH);
    when(mockBindingProvider.getDirection("MySwitch")).thenReturn(LightwaveRfItemDirection.IN_AND_OUT);
    LightwaveRfBinding binding = new LightwaveRfBinding();
    binding.addBindingProvider(mockBindingProvider);
    binding.setEventPublisher(mockEventPublisher);
    binding.roomDeviceMessageReceived(new LightwaveRfOnOffCommand(1, "2", "3", true));
    verify(mockEventPublisher).postUpdate("MySwitch", OnOffType.ON);
}
Also used : LightwaveRfOnOffCommand(org.openhab.binding.lightwaverf.internal.command.LightwaveRfOnOffCommand) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)5 LightwaveRfOnOffCommand (org.openhab.binding.lightwaverf.internal.command.LightwaveRfOnOffCommand)5 LightwaveRFCommand (org.openhab.binding.lightwaverf.internal.command.LightwaveRFCommand)4