]> git.basschouten.com Git - openhab-addons.git/blob
36267a46f523ecc612baba633db7d2506249c50c
[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.OnOffType;
23
24 /**
25  * Test class.
26  *
27  * @author Fabian Wolter - Initial contribution
28  */
29 @NonNullByDefault
30 public class LcnModuleRvarLockSubHandlerTest extends AbstractTestLcnModuleSubHandler {
31     private @NonNullByDefault({}) LcnModuleRvarLockSubHandler l;
32
33     @Override
34     @BeforeEach
35     public void setUp() {
36         super.setUp();
37
38         l = new LcnModuleRvarLockSubHandler(handler, info);
39     }
40
41     @Test
42     public void testLock1() throws LcnException {
43         l.handleCommandOnOff(OnOffType.ON, LcnChannelGroup.RVARLOCK, 0);
44         verify(handler).sendPck("REAXS");
45     }
46
47     @Test
48     public void testLock2() throws LcnException {
49         l.handleCommandOnOff(OnOffType.ON, LcnChannelGroup.RVARLOCK, 1);
50         verify(handler).sendPck("REBXS");
51     }
52
53     @Test
54     public void testUnlock1() throws LcnException {
55         l.handleCommandOnOff(OnOffType.OFF, LcnChannelGroup.RVARLOCK, 0);
56         verify(handler).sendPck("REAXA");
57     }
58
59     @Test
60     public void testUnlock2() throws LcnException {
61         l.handleCommandOnOff(OnOffType.OFF, LcnChannelGroup.RVARLOCK, 1);
62         verify(handler).sendPck("REBXA");
63     }
64 }