2 * Copyright (c) 2010-2022 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.miele.internal;
15 import static org.junit.jupiter.api.Assertions.*;
17 import org.junit.jupiter.api.Test;
18 import org.openhab.core.test.java.JavaTest;
21 * This class provides test cases for {@link
22 * org.openhab.binding.miele.internal.FullyQualifiedApplianceIdentifier}
24 * @author Jacob Laursen - Initial contribution
26 public class FullyQualifiedApplianceIdentifierTest extends JavaTest {
29 public void getUidWhenConstructedFromUidReturnsUid() {
30 var identifier = new FullyQualifiedApplianceIdentifier("hdm:ZigBee:0123456789abcdef#210");
31 assertEquals("hdm:ZigBee:0123456789abcdef#210", identifier.getUid());
35 public void getUidWhenConstructedFromApplianceIdAndProtocolReturnsUid() {
36 var identifier = new FullyQualifiedApplianceIdentifier("0123456789abcdef#210", "hdm:LAN:");
37 assertEquals("hdm:LAN:0123456789abcdef#210", identifier.getUid());
41 public void getApplianceIdWhenConstructedFromUidReturnsApplianceId() {
42 var identifier = new FullyQualifiedApplianceIdentifier("hdm:ZigBee:0123456789abcdef#210");
43 assertEquals("0123456789abcdef#210", identifier.getApplianceId());
47 public void getApplianceIdWhenConstructedFromApplianceIdAndProtocolReturnsApplianceId() {
48 var identifier = new FullyQualifiedApplianceIdentifier("0123456789abcdef#210", "hdm:LAN:");
49 assertEquals("0123456789abcdef#210", identifier.getApplianceId());
53 public void getIdWhenConstructedFromUidReturnsProtocol() {
54 var identifier = new FullyQualifiedApplianceIdentifier("hdm:ZigBee:0123456789abcdef#210");
55 assertEquals("0123456789abcdef_210", identifier.getId());
59 public void getIdWhenConstructedFromApplianceIdAndProtocolReturnsProtocol() {
60 var identifier = new FullyQualifiedApplianceIdentifier("0123456789abcdef#210", "hdm:LAN:");
61 assertEquals("0123456789abcdef_210", identifier.getId());
65 public void getProtocolWhenConstructedFromUidReturnsProtocol() {
66 var identifier = new FullyQualifiedApplianceIdentifier("hdm:ZigBee:0123456789abcdef#210");
67 assertEquals("hdm:ZigBee:", identifier.getProtocol());
71 public void getProtocolWhenConstructedFromApplianceIdAndProtocolReturnsProtocol() {
72 var identifier = new FullyQualifiedApplianceIdentifier("0123456789abcdef#210", "hdm:LAN:");
73 assertEquals("hdm:LAN:", identifier.getProtocol());