]> git.basschouten.com Git - openhab-addons.git/blob
f8afd51e5fc5a21e8b8d3b8addb654ec4db7d8f8
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 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.mielecloud.internal.webservice.api.json;
14
15 import static org.junit.jupiter.api.Assertions.assertEquals;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.junit.jupiter.api.Test;
19
20 /**
21  * @author Björn Lange - Initial contribution
22  */
23 @NonNullByDefault
24 public class LightTest {
25     @Test
26     public void testFromNullId() {
27         // when:
28         Light light = Light.fromId(null);
29
30         // then:
31         assertEquals(Light.UNKNOWN, light);
32     }
33
34     @Test
35     public void testFromNotSupportedId() {
36         // when:
37         Light light = Light.fromId(0);
38
39         // then:
40         assertEquals(Light.NOT_SUPPORTED, light);
41     }
42
43     @Test
44     public void testFromNotSupportedAlternativeId() {
45         // when:
46         Light light = Light.fromId(255);
47
48         // then:
49         assertEquals(Light.NOT_SUPPORTED, light);
50     }
51
52     @Test
53     public void testFromEnabledId() {
54         // when:
55         Light light = Light.fromId(1);
56
57         // then:
58         assertEquals(Light.ENABLE, light);
59     }
60
61     @Test
62     public void testFromDisabledId() {
63         // when:
64         Light light = Light.fromId(2);
65
66         // then:
67         assertEquals(Light.DISABLE, light);
68     }
69 }