]> git.basschouten.com Git - openhab-addons.git/blob
103a02ff139acd75f8408d17b0da3fa24a69f4b6
[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 java.math.BigDecimal;
16 import java.util.ArrayList;
17 import java.util.List;
18
19 import org.junit.jupiter.api.BeforeEach;
20 import org.junit.jupiter.api.Test;
21 import org.openhab.core.library.types.DecimalType;
22 import org.openhab.core.library.types.OnOffType;
23 import org.openhab.core.types.StateOption;
24
25 /**
26  * Test class for (@link LxControlRadio} - variant with 'all off' selection
27  *
28  * @author Pawel Pieczul - initial contribution
29  *
30  */
31 public class LxControlRadioTest2 extends LxControlRadioTest {
32     @Override
33     @BeforeEach
34     public void setup() {
35         setupControl("1255054f-0355-af47-ffff403fb0c34b9e", "11d68cf4-0080-7697-ffff403fb0c34b9e",
36                 "0fe650c2-0004-d446-ffff504f9410790f", "Sprinkler 2");
37     }
38
39     @Override
40     @Test
41     public void testChannels() {
42         List<StateOption> opts = new ArrayList<>();
43         for (Integer i = 1; i <= 6; i++) {
44             opts.add(new StateOption(i.toString(), "Sprinkler " + i.toString()));
45         }
46         opts.add(new StateOption("0", "All Off"));
47         testChannel("Number", null, BigDecimal.ZERO, new BigDecimal(16), BigDecimal.ONE, null, false, opts);
48     }
49
50     @Override
51     @Test
52     public void testLoxoneZeroIndexChanges() {
53         changeLoxoneState("activeoutput", 0.0);
54         testChannelState(new DecimalType(0));
55     }
56
57     @Override
58     @Test
59     public void testZeroIndexCommands() {
60         executeCommand(DecimalType.ZERO);
61         testAction("reset");
62         executeCommand(OnOffType.OFF);
63         testAction("reset");
64     }
65 }