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.ArgumentMatchers.any;
16 import static org.mockito.Mockito.*;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.junit.jupiter.api.BeforeEach;
20 import org.junit.jupiter.api.Test;
21 import org.openhab.binding.lcn.internal.common.LcnChannelGroup;
26 * @author Andre Jendrysseck - Initial contribution
29 public class LcnModuleCodeSubHandlerTest extends AbstractTestLcnModuleSubHandler {
38 public void testHexFingerprint() {
39 tryParseAllHandlers("=M000005.ZFABCDEF");
40 verify(handler).triggerChannel(LcnChannelGroup.CODE, "fingerprint", "ABCDEF");
41 verify(handler).triggerChannel(any(), any(), any());
45 public void testDecFingerprint() {
46 tryParseAllHandlers("=M000005.ZF255001002");
47 verify(handler).triggerChannel(LcnChannelGroup.CODE, "fingerprint", "FF0102");
48 verify(handler).triggerChannel(any(), any(), any());
52 public void testTransponder() {
53 tryParseAllHandlers("=M000005.ZT255001002");
54 verify(handler).triggerChannel(LcnChannelGroup.CODE, "transponder", "FF0102");
55 verify(handler).triggerChannel(any(), any(), any());
59 public void testRemote() {
60 tryParseAllHandlers("=M000005.ZI255001002013001");
61 verify(handler).triggerChannel(LcnChannelGroup.CODE, "remotecontrolkey", "B3:HIT");
62 verify(handler).triggerChannel(LcnChannelGroup.CODE, "remotecontrolcode", "FF0102:B3:HIT");
63 verify(handler, times(2)).triggerChannel(any(), any(), any());
67 public void testRemoteBatteryLow() {
68 tryParseAllHandlers("=M000005.ZI255001002008012");
69 verify(handler).triggerChannel(LcnChannelGroup.CODE, "remotecontrolkey", "A8:MAKE");
70 verify(handler).triggerChannel(LcnChannelGroup.CODE, "remotecontrolcode", "FF0102:A8:MAKE");
71 verify(handler).triggerChannel(LcnChannelGroup.CODE, "remotecontrolbatterylow", "FF0102");
72 verify(handler, times(3)).triggerChannel(any(), any(), any());