2 * Copyright (c) 2010-2022 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.lcn.internal.subhandler;
15 import static org.mockito.Mockito.verify;
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.StopMoveType;
23 import org.openhab.core.library.types.UpDownType;
28 * @author Fabian Wolter - Initial contribution
31 public class LcnModuleRollershutterRelaySubHandlerTest extends AbstractTestLcnModuleSubHandler {
32 private @NonNullByDefault({}) LcnModuleRollershutterRelaySubHandler l;
39 l = new LcnModuleRollershutterRelaySubHandler(handler, info);
43 public void testUp1() throws LcnException {
44 l.handleCommandUpDown(UpDownType.UP, LcnChannelGroup.ROLLERSHUTTERRELAY, 0, false);
45 verify(handler).sendPck("R810------");
49 public void testUpInverted() throws LcnException {
50 l.handleCommandUpDown(UpDownType.UP, LcnChannelGroup.ROLLERSHUTTERRELAY, 0, true);
51 verify(handler).sendPck("R811------");
55 public void testUp4() throws LcnException {
56 l.handleCommandUpDown(UpDownType.UP, LcnChannelGroup.ROLLERSHUTTERRELAY, 3, false);
57 verify(handler).sendPck("R8------10");
61 public void testDown1() throws LcnException {
62 l.handleCommandUpDown(UpDownType.DOWN, LcnChannelGroup.ROLLERSHUTTERRELAY, 0, false);
63 verify(handler).sendPck("R811------");
67 public void testDownInverted() throws LcnException {
68 l.handleCommandUpDown(UpDownType.DOWN, LcnChannelGroup.ROLLERSHUTTERRELAY, 0, true);
69 verify(handler).sendPck("R810------");
73 public void testDown4() throws LcnException {
74 l.handleCommandUpDown(UpDownType.DOWN, LcnChannelGroup.ROLLERSHUTTERRELAY, 3, false);
75 verify(handler).sendPck("R8------11");
79 public void testStop1() throws LcnException {
80 l.handleCommandStopMove(StopMoveType.STOP, LcnChannelGroup.ROLLERSHUTTERRELAY, 0);
81 verify(handler).sendPck("R80-------");
85 public void testStop4() throws LcnException {
86 l.handleCommandStopMove(StopMoveType.STOP, LcnChannelGroup.ROLLERSHUTTERRELAY, 3);
87 verify(handler).sendPck("R8------0-");
91 public void testMove1() throws LcnException {
92 l.handleCommandStopMove(StopMoveType.MOVE, LcnChannelGroup.ROLLERSHUTTERRELAY, 0);
93 verify(handler).sendPck("R81-------");
97 public void testMove4() throws LcnException {
98 l.handleCommandStopMove(StopMoveType.MOVE, LcnChannelGroup.ROLLERSHUTTERRELAY, 3);
99 verify(handler).sendPck("R8------1-");