]> git.basschouten.com Git - openhab-addons.git/blob
cb5fb72404ff224904f0ab11fe4bd11da2a04b20
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2021 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.bluetooth.govee.internal;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.junit.jupiter.api.Assertions;
17 import org.junit.jupiter.api.Test;
18 import org.openhab.binding.bluetooth.MockBluetoothAdapter;
19 import org.openhab.binding.bluetooth.MockBluetoothDevice;
20 import org.openhab.binding.bluetooth.TestUtils;
21 import org.openhab.binding.bluetooth.discovery.BluetoothDiscoveryDevice;
22
23 /**
24  * @author Connor Petty - Initial contribution
25  *
26  */
27 @NonNullByDefault
28 class GoveeModelTest {
29
30     // the participant is stateless so this is fine.
31     // private GoveeDiscoveryParticipant participant = new GoveeDiscoveryParticipant();
32
33     @Test
34     void noMatchTest() {
35         MockBluetoothAdapter adapter = new MockBluetoothAdapter();
36         MockBluetoothDevice mockDevice = adapter.getDevice(TestUtils.randomAddress());
37         mockDevice.setName("asdfasdf");
38
39         Assertions.assertNull(GoveeModel.getGoveeModel(new BluetoothDiscoveryDevice(mockDevice)));
40     }
41
42     @Test
43     void testGovee_H5074_84DD() {
44         MockBluetoothAdapter adapter = new MockBluetoothAdapter();
45         MockBluetoothDevice mockDevice = adapter.getDevice(TestUtils.randomAddress());
46         mockDevice.setName("Govee_H5074_84DD");
47
48         Assertions.assertEquals(GoveeModel.H5074, GoveeModel.getGoveeModel(new BluetoothDiscoveryDevice(mockDevice)));
49     }
50 }