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