]> git.basschouten.com Git - openhab-addons.git/blob
3460529490e4ad229280d0d5da9e2afd7289281c
[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.netatmo.internal.handler.channelhelper;
14
15 import static org.junit.jupiter.api.Assertions.*;
16 import static org.openhab.binding.netatmo.internal.NetatmoBindingConstants.*;
17
18 import java.util.Collections;
19
20 import org.junit.jupiter.api.BeforeEach;
21 import org.junit.jupiter.api.Test;
22 import org.openhab.binding.netatmo.internal.api.data.EventType;
23 import org.openhab.binding.netatmo.internal.api.dto.HomeEvent;
24 import org.openhab.core.library.types.StringType;
25 import org.openhab.core.types.State;
26
27 /**
28  * @author Sven Strohschein - Initial contribution
29  */
30 public class EventCameraChannelHelperTest {
31
32     private EventCameraChannelHelper helper;
33
34     @BeforeEach
35     public void before() {
36         helper = new EventCameraChannelHelper(Collections.emptySet());
37     }
38
39     @Test
40     public void testInternalGetHomeEventGroupSubEvent() {
41         State state = helper.internalGetHomeEvent(CHANNEL_EVENT_TYPE, GROUP_SUB_EVENT, new HomeEvent());
42         assertTrue(state instanceof StringType);
43         assertEquals(EventType.UNKNOWN.name(), state.toString());
44     }
45
46     @Test
47     public void testInternalGetHomeEventGroupDoorbellSubEvent() {
48         State state = helper.internalGetHomeEvent(CHANNEL_EVENT_TYPE, GROUP_DOORBELL_SUB_EVENT, new HomeEvent());
49         assertTrue(state instanceof StringType);
50         assertEquals(EventType.UNKNOWN.name(), state.toString());
51     }
52
53     @Test
54     public void testInternalGetHomeEventGroupDoorbellStatus() {
55         State state = helper.internalGetHomeEvent(CHANNEL_EVENT_TYPE, GROUP_DOORBELL_STATUS, new HomeEvent());
56         // Only sub-event groups are handled by EventCameraChannelHelper. GROUP_DOORBELL_STATUS isn't a sub-event group.
57         assertNull(state);
58     }
59 }