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.boschshc.internal.devices;
15 import static org.junit.jupiter.api.Assertions.*;
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.boschshc.internal.devices.plug.PlugHandler;
22 import org.openhab.core.thing.Thing;
23 import org.openhab.core.thing.ThingTypeUID;
26 * Unit tests for {@link BoschSHCHandlerFactory}.
28 * @author David Pace - Initial contribution
32 class BoschSHCHandlerFactoryTest {
34 private @NonNullByDefault({}) BoschSHCHandlerFactory fixture;
37 public void setUp() throws Exception {
38 fixture = new BoschSHCHandlerFactory();
42 void testSupportsThingType() {
43 assertTrue(fixture.supportsThingType(BoschSHCBindingConstants.THING_TYPE_SHC));
44 assertTrue(fixture.supportsThingType(BoschSHCBindingConstants.THING_TYPE_INWALL_SWITCH));
45 assertTrue(fixture.supportsThingType(BoschSHCBindingConstants.THING_TYPE_TWINGUARD));
46 assertTrue(fixture.supportsThingType(BoschSHCBindingConstants.THING_TYPE_WINDOW_CONTACT));
47 assertTrue(fixture.supportsThingType(BoschSHCBindingConstants.THING_TYPE_MOTION_DETECTOR));
48 assertTrue(fixture.supportsThingType(BoschSHCBindingConstants.THING_TYPE_SHUTTER_CONTROL));
49 assertTrue(fixture.supportsThingType(BoschSHCBindingConstants.THING_TYPE_THERMOSTAT));
50 assertTrue(fixture.supportsThingType(BoschSHCBindingConstants.THING_TYPE_CLIMATE_CONTROL));
51 assertTrue(fixture.supportsThingType(BoschSHCBindingConstants.THING_TYPE_WALL_THERMOSTAT));
52 assertTrue(fixture.supportsThingType(BoschSHCBindingConstants.THING_TYPE_CAMERA_360));
53 assertTrue(fixture.supportsThingType(BoschSHCBindingConstants.THING_TYPE_CAMERA_EYES));
54 assertTrue(fixture.supportsThingType(BoschSHCBindingConstants.THING_TYPE_INTRUSION_DETECTION_SYSTEM));
55 assertTrue(fixture.supportsThingType(BoschSHCBindingConstants.THING_TYPE_SMART_PLUG_COMPACT));
56 assertTrue(fixture.supportsThingType(BoschSHCBindingConstants.THING_TYPE_SMART_BULB));
57 assertTrue(fixture.supportsThingType(BoschSHCBindingConstants.THING_TYPE_SMOKE_DETECTOR));
59 assertFalse(fixture.supportsThingType(new ThingTypeUID(BoschSHCBindingConstants.BINDING_ID, "foo")));
63 void testCreateHandler() {
64 Thing thing = mock(Thing.class);
65 when(thing.getThingTypeUID()).thenReturn(BoschSHCBindingConstants.THING_TYPE_SMART_PLUG_COMPACT);
66 assertTrue(fixture.createHandler(thing) instanceof PlugHandler);