]> git.basschouten.com Git - openhab-addons.git/blob
561cd50620c44f1df1e5a3415fc646c13379ebb4
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.rfxcom.internal.messages;
14
15 import static org.junit.jupiter.api.Assertions.*;
16 import static org.openhab.binding.rfxcom.internal.messages.RFXComBaseMessage.PacketType.HOME_CONFORT;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.junit.jupiter.api.Test;
20 import org.openhab.binding.rfxcom.internal.exceptions.RFXComException;
21 import org.openhab.binding.rfxcom.internal.messages.RFXComHomeConfortMessage.Commands;
22 import org.openhab.binding.rfxcom.internal.messages.RFXComHomeConfortMessage.SubType;
23 import org.openhab.core.util.HexUtils;
24
25 /**
26  * Test for RFXCom-binding
27  *
28  * @author Martin van Wingerden - Initial contribution
29  * @author Mike Jagdis - added message handling and real test
30  */
31 @NonNullByDefault
32 public class RFXComHomeConfortTest {
33     private void testMessage(SubType subType, Commands command, String deviceId, String data) throws RFXComException {
34         RFXComHomeConfortMessage message = (RFXComHomeConfortMessage) RFXComMessageFactory.createMessage(HOME_CONFORT);
35         message.setSubType(subType);
36         message.command = command;
37         message.setDeviceId(deviceId);
38
39         assertArrayEquals(HexUtils.hexToBytes(data), message.decodeMessage());
40     }
41
42     @Test
43     public void testMessage1() throws RFXComException {
44         testMessage(SubType.TEL_010, Commands.GROUP_ON, "1118739.A.4", "0C1B0000111213410403000000");
45     }
46 }