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.rfxcom.internal.config;
15 import static org.junit.jupiter.api.Assertions.*;
17 import org.junit.jupiter.api.BeforeEach;
18 import org.junit.jupiter.api.Test;
19 import org.junit.jupiter.api.extension.ExtendWith;
20 import org.mockito.junit.jupiter.MockitoExtension;
21 import org.openhab.binding.rfxcom.internal.exceptions.RFXComInvalidParameterException;
24 * Configuration class for generic devices.
26 * @author James Hewitt-Thomas - Initial contribution
28 @ExtendWith(MockitoExtension.class)
29 public class RFXComGenericDeviceConfigurationTest {
31 private RFXComGenericDeviceConfiguration config;
34 public void before() {
35 config = new RFXComGenericDeviceConfiguration();
39 public void testNoDeviceId() {
40 config.subType = "PT2262";
41 assertThrows(RFXComInvalidParameterException.class, () -> config.parseAndValidate());
45 public void testNoSubType() {
46 config.deviceId = "90000";
47 assertThrows(RFXComInvalidParameterException.class, () -> config.parseAndValidate());
51 public void testValidConfig() {
52 config.deviceId = "90000";
53 config.subType = "PT2262";
54 assertDoesNotThrow(() -> config.parseAndValidate());