]> git.basschouten.com Git - openhab-addons.git/blob
a24dea5f88b9faf25ef2407d9868ab6048fc3932
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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.max.internal.message;
14
15 import static org.junit.jupiter.api.Assertions.*;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.junit.jupiter.api.Test;
19 import org.openhab.binding.max.internal.device.DeviceType;
20
21 /**
22  * Tests cases for {@link CMessage}.
23  *
24  * @author Andreas Heil (info@aheil.de) - Initial contribution
25  * @author Marcel Verpaalen - OH2 Version and updates
26  */
27 @NonNullByDefault
28 public class CMessageTest {
29
30     public static final String RAW_DATA = "C:0b0da3,0gsNowIBEABLRVEwNTQ0MjQyLCQ9CQcYAzAM/wBIYViRSP1ZFE0gTSBNIEUgRSBFIEUgRSBFIEhhWJFQ/VkVUSBRIFEgRSBFIEUgRSBFIEUgSFBYWkj+WRRNIE0gTSBFIEUgRSBFIEUgRSBIUFhaSP5ZFE0gTSBNIEUgRSBFIEUgRSBFIEhQWFpI/lkUTSBNIE0gRSBFIEUgRSBFIEUgSFBYWkj+WRRNIE0gTSBFIEUgRSBFIEUgRSBIUFhaSP5ZFE0gTSBNIEUgRSBFIEUgRSBFIA==";
31     private final CMessage message = new CMessage(RAW_DATA);
32
33     @Test
34     public void getMessageTypeTest() {
35         MessageType messageType = ((Message) message).getType();
36         assertEquals(MessageType.C, messageType);
37     }
38
39     @Test
40     public void getRFAddressTest() {
41         String rfAddress = message.getRFAddress();
42         assertEquals("0b0da3", rfAddress);
43     }
44
45     @Test
46     public void getDeviceTypeTest() {
47         DeviceType deviceType = message.getDeviceType();
48         assertEquals(DeviceType.HeatingThermostatPlus, deviceType);
49     }
50
51     @Test
52     public void getSerialNumberTes() {
53         String serialNumber = message.getSerialNumber();
54         assertEquals("KEQ0544242", serialNumber);
55     }
56 }