2 * Copyright (c) 2010-2023 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.LcnDefs;
22 import org.openhab.binding.lcn.internal.common.LcnException;
23 import org.openhab.core.library.types.OnOffType;
24 import org.openhab.core.library.types.StringType;
29 * @author Fabian Wolter - Initial contribution
32 public class LcnModuleLedSubHandlerTest extends AbstractTestLcnModuleSubHandler {
33 private @NonNullByDefault({}) LcnModuleLedSubHandler l;
40 l = new LcnModuleLedSubHandler(handler, info);
44 public void testHandleCommandLed1Off() throws LcnException {
45 l.handleCommandString(new StringType(LcnDefs.LedStatus.OFF.name()), 0);
46 verify(handler).sendPck("LA001A");
50 public void testHandleCommandLed1On() throws LcnException {
51 l.handleCommandString(new StringType(LcnDefs.LedStatus.ON.name()), 0);
52 verify(handler).sendPck("LA001E");
56 public void testHandleCommandLed1Blink() throws LcnException {
57 l.handleCommandString(new StringType(LcnDefs.LedStatus.BLINK.name()), 0);
58 verify(handler).sendPck("LA001B");
62 public void testHandleCommandLed1Flicker() throws LcnException {
63 l.handleCommandString(new StringType(LcnDefs.LedStatus.FLICKER.name()), 0);
64 verify(handler).sendPck("LA001F");
68 public void testHandleCommandLed12On() throws LcnException {
69 l.handleCommandString(new StringType(LcnDefs.LedStatus.ON.name()), 11);
70 verify(handler).sendPck("LA012E");
74 public void testHandleOnOffCommandLed1Off() throws LcnException {
75 l.handleCommandOnOff(OnOffType.OFF, LcnChannelGroup.LED, 0);
76 verify(handler).sendPck("LA001A");
80 public void testHandleOnOffCommandLed1On() throws LcnException {
81 l.handleCommandOnOff(OnOffType.ON, LcnChannelGroup.LED, 0);
82 verify(handler).sendPck("LA001E");