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.netatmo.internal.handler.channelhelper;
15 import static org.junit.jupiter.api.Assertions.*;
16 import static org.openhab.binding.netatmo.internal.NetatmoBindingConstants.*;
18 import java.util.Collections;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.junit.jupiter.api.BeforeEach;
22 import org.junit.jupiter.api.Test;
23 import org.openhab.binding.netatmo.internal.api.data.EventType;
24 import org.openhab.binding.netatmo.internal.api.dto.HomeEvent;
25 import org.openhab.core.library.types.StringType;
26 import org.openhab.core.types.State;
29 * @author Sven Strohschein - Initial contribution
32 public class EventCameraChannelHelperTest {
34 private @NonNullByDefault({}) EventCameraChannelHelper helper;
37 public void before() {
38 helper = new EventCameraChannelHelper(Collections.emptySet());
42 public void testInternalGetHomeEventGroupSubEvent() {
43 State state = helper.internalGetHomeEvent(CHANNEL_EVENT_TYPE, GROUP_SUB_EVENT, new HomeEvent());
44 assertTrue(state instanceof StringType);
45 assertEquals(EventType.UNKNOWN.name(), state.toString());
49 public void testInternalGetHomeEventGroupDoorbellSubEvent() {
50 State state = helper.internalGetHomeEvent(CHANNEL_EVENT_TYPE, GROUP_DOORBELL_SUB_EVENT, new HomeEvent());
51 assertTrue(state instanceof StringType);
52 assertEquals(EventType.UNKNOWN.name(), state.toString());
56 public void testInternalGetHomeEventGroupDoorbellStatus() {
57 State state = helper.internalGetHomeEvent(CHANNEL_EVENT_TYPE, GROUP_DOORBELL_STATUS, new HomeEvent());
58 // Only sub-event groups are handled by EventCameraChannelHelper. GROUP_DOORBELL_STATUS isn't a sub-event group.