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