]> git.basschouten.com Git - openhab-addons.git/blob
5b8923da3a320bd2487215b9669e9f9ec8609c6e
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2021 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.miele.internal;
14
15 import static org.junit.jupiter.api.Assertions.*;
16
17 import org.junit.jupiter.api.Test;
18 import org.openhab.core.test.java.JavaTest;
19
20 /**
21  * This class provides test cases for {@link
22  * org.openhab.binding.miele.internal.FullyQualifiedApplianceIdentifier}
23  *
24  * @author Jacob Laursen - Initial contribution
25  */
26 public class FullyQualifiedApplianceIdentifierTest extends JavaTest {
27
28     @Test
29     public void getUidWhenConstructedFromUidReturnsUid() {
30         var identifier = new FullyQualifiedApplianceIdentifier("hdm:ZigBee:0123456789abcdef#210");
31         assertEquals("hdm:ZigBee:0123456789abcdef#210", identifier.getUid());
32     }
33
34     @Test
35     public void getUidWhenConstructedFromApplianceIdAndProtocolReturnsUid() {
36         var identifier = new FullyQualifiedApplianceIdentifier("0123456789abcdef#210", "hdm:LAN:");
37         assertEquals("hdm:LAN:0123456789abcdef#210", identifier.getUid());
38     }
39
40     @Test
41     public void getApplianceIdWhenConstructedFromUidReturnsApplianceId() {
42         var identifier = new FullyQualifiedApplianceIdentifier("hdm:ZigBee:0123456789abcdef#210");
43         assertEquals("0123456789abcdef#210", identifier.getApplianceId());
44     }
45
46     @Test
47     public void getApplianceIdWhenConstructedFromApplianceIdAndProtocolReturnsApplianceId() {
48         var identifier = new FullyQualifiedApplianceIdentifier("0123456789abcdef#210", "hdm:LAN:");
49         assertEquals("0123456789abcdef#210", identifier.getApplianceId());
50     }
51
52     @Test
53     public void getIdWhenConstructedFromUidReturnsProtocol() {
54         var identifier = new FullyQualifiedApplianceIdentifier("hdm:ZigBee:0123456789abcdef#210");
55         assertEquals("0123456789abcdef_210", identifier.getId());
56     }
57
58     @Test
59     public void getIdWhenConstructedFromApplianceIdAndProtocolReturnsProtocol() {
60         var identifier = new FullyQualifiedApplianceIdentifier("0123456789abcdef#210", "hdm:LAN:");
61         assertEquals("0123456789abcdef_210", identifier.getId());
62     }
63
64     @Test
65     public void getProtocolWhenConstructedFromUidReturnsProtocol() {
66         var identifier = new FullyQualifiedApplianceIdentifier("hdm:ZigBee:0123456789abcdef#210");
67         assertEquals("hdm:ZigBee:", identifier.getProtocol());
68     }
69
70     @Test
71     public void getProtocolWhenConstructedFromApplianceIdAndProtocolReturnsProtocol() {
72         var identifier = new FullyQualifiedApplianceIdentifier("0123456789abcdef#210", "hdm:LAN:");
73         assertEquals("hdm:LAN:", identifier.getProtocol());
74     }
75 }