]> git.basschouten.com Git - openhab-addons.git/blob
3273f49790287b6636a5f467ed6b0956e2b6ad17
[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.loxone.internal.controls;
14
15 import org.junit.jupiter.api.BeforeEach;
16 import org.junit.jupiter.api.Test;
17 import org.openhab.core.library.types.OnOffType;
18 import org.openhab.core.types.UnDefType;
19
20 /**
21  * Test class for (@link LxControlInfoOnlyDigital}
22  *
23  * @author Pawel Pieczul - initial contribution
24  *
25  */
26 public class LxControlInfoOnlyDigitalTest extends LxControlTest {
27     @BeforeEach
28     public void setup() {
29         setupControl("101b50f7-0306-98fb-ffff403fb0c34b9e", "0e368d32-014f-4604-ffff403fb0c34b9e",
30                 "101b563d-0302-78bd-ffff403fb0c34b9e", "Info Only Digital");
31     }
32
33     @Test
34     public void testControlCreation() {
35         testControlCreation(LxControlInfoOnlyDigital.class, 1, 0, 1, 1, 1);
36     }
37
38     @Test
39     public void testChannels() {
40         testChannel("Switch");
41     }
42
43     @Test
44     public void testLoxoneStateChanges() {
45         for (Double i = 2.0; i < 100.0; i++) {
46             changeLoxoneState("active", 0.0);
47             testChannelState(OnOffType.OFF);
48             changeLoxoneState("active", 1.0);
49             testChannelState(OnOffType.ON);
50             changeLoxoneState("active", 1.0 / i);
51             testChannelState(UnDefType.UNDEF);
52         }
53     }
54 }