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.govee.internal;
15 import static org.junit.jupiter.api.Assertions.*;
18 import java.util.Objects;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.eclipse.jdt.annotation.Nullable;
22 import org.junit.jupiter.api.Test;
23 import org.openhab.binding.govee.internal.model.DiscoveryResponse;
24 import org.openhab.core.config.discovery.DiscoveryResult;
26 import com.google.gson.Gson;
29 * @author Stefan Höhn - Initial contribution
32 public class GoveeDiscoveryTest {
39 "ip":"192.168.178.171",
40 "device":"7D:31:C3:35:33:33:44:15",
42 "bleVersionHard":"3.01.01",
43 "bleVersionSoft":"1.04.04",
44 "wifiVersionHard":"1.00.10",
45 "wifiVersionSoft":"1.02.11"
52 public void testProcessScanMessage() {
53 GoveeDiscoveryService service = new GoveeDiscoveryService(new CommunicationManager());
54 DiscoveryResponse resp = new Gson().fromJson(response, DiscoveryResponse.class);
55 Objects.requireNonNull(resp);
57 DiscoveryResult result = service.responseToResult(resp);
58 assertNotNull(result);
59 Map<String, Object> deviceProperties = result.getProperties();
60 assertEquals(deviceProperties.get(GoveeBindingConstants.DEVICE_TYPE), "H6076");
61 assertEquals(deviceProperties.get(GoveeBindingConstants.IP_ADDRESS), "192.168.178.171");
62 assertEquals(deviceProperties.get(GoveeBindingConstants.MAC_ADDRESS), "7D:31:C3:35:33:33:44:15");