]> git.basschouten.com Git - openhab-addons.git/blob
f9184c1a203213a1dd8691f6ff4c6bc111eea149
[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.lcn.internal.subhandler;
14
15 import static org.mockito.Mockito.verify;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.junit.jupiter.api.BeforeEach;
19 import org.junit.jupiter.api.Test;
20 import org.openhab.binding.lcn.internal.common.LcnChannelGroup;
21 import org.openhab.binding.lcn.internal.common.LcnException;
22 import org.openhab.core.library.types.PercentType;
23
24 /**
25  * Test class.
26  *
27  * @author Fabian Wolter - Initial contribution
28  */
29 @NonNullByDefault
30 public class LcnModuleRollershutterRelaySlatAngleSubHandlerTest extends AbstractTestLcnModuleSubHandler {
31     private @NonNullByDefault({}) AbstractLcnModuleRollershutterRelaySubHandler l;
32
33     @Override
34     @BeforeEach
35     public void setUp() {
36         super.setUp();
37
38         l = new LcnModuleRollershutterRelaySlatAngleSubHandler(handler, info);
39     }
40
41     @Test
42     public void testMotor1percent0() throws LcnException {
43         l.handleCommandPercent(PercentType.ZERO, LcnChannelGroup.ROLLERSHUTTERRELAYSLAT, 0);
44         verify(handler).sendPck("JW000001");
45     }
46
47     @Test
48     public void testMotor1percent100() throws LcnException {
49         l.handleCommandPercent(PercentType.HUNDRED, LcnChannelGroup.ROLLERSHUTTERRELAYSLAT, 0);
50         verify(handler).sendPck("JW100001");
51     }
52
53     @Test
54     public void testMotor1percent50() throws LcnException {
55         l.handleCommandPercent(new PercentType(50), LcnChannelGroup.ROLLERSHUTTERRELAYSLAT, 0);
56         verify(handler).sendPck("JW050001");
57     }
58
59     @Test
60     public void testMotor4percent50() throws LcnException {
61         l.handleCommandPercent(new PercentType(50), LcnChannelGroup.ROLLERSHUTTERRELAYSLAT, 3);
62         verify(handler).sendPck("JW050008");
63     }
64 }