2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.max.internal.message;
15 import static org.junit.jupiter.api.Assertions.*;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.junit.jupiter.api.BeforeEach;
20 import org.junit.jupiter.api.Test;
21 import org.openhab.binding.max.internal.device.DeviceConfiguration;
22 import org.openhab.binding.max.internal.device.DeviceType;
25 * Tests cases for {@link DeviceConfiguration}.
27 * @author Andreas Heil - Initial contribution
28 * @author Marcel Verpaalen - OH2 Version and updates
31 public class ConfigurationTest {
33 public static final String RAW_DATA = "C:0b0da3,0gsNowIBEABLRVEwNTQ0MjQyLCQ9CQcYAzAM/wBIYViRSP1ZFE0gTSBNIEUgRSBFIEUgRSBFIEhhWJFQ/VkVUSBRIFEgRSBFIEUgRSBFIEUgSFBYWkj+WRRNIE0gTSBFIEUgRSBFIEUgRSBIUFhaSP5ZFE0gTSBNIEUgRSBFIEUgRSBFIEhQWFpI/lkUTSBNIE0gRSBFIEUgRSBFIEUgSFBYWkj+WRRNIE0gTSBFIEUgRSBFIEUgRSBIUFhaSP5ZFE0gTSBNIEUgRSBFIEUgRSBFIA==";
35 private final CMessage message = new CMessage(RAW_DATA);
36 private @Nullable DeviceConfiguration configuration;
39 public void before() {
40 configuration = DeviceConfiguration.create(message);
44 public void createTest() {
45 assertNotNull(configuration);
49 public void getRfAddressTest() {
50 final DeviceConfiguration configuration = this.configuration;
51 if (configuration != null) {
52 String rfAddress = configuration.getRFAddress();
53 assertEquals("0b0da3", rfAddress);
55 fail("Configuration missing");
60 public void getDeviceTypeTest() {
61 final DeviceConfiguration configuration = this.configuration;
62 if (configuration != null) {
63 DeviceType deviceType = configuration.getDeviceType();
64 assertEquals(DeviceType.HeatingThermostatPlus, deviceType);
66 fail("Configuration missing");
71 public void getSerialNumberTest() {
72 final DeviceConfiguration configuration = this.configuration;
73 if (configuration != null) {
74 String serialNumber = configuration.getSerialNumber();
75 assertEquals("KEQ0544242", serialNumber);
77 fail("Configuration missing");