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.bridge.dto;
15 import static org.junit.jupiter.api.Assertions.*;
17 import java.util.Collections;
18 import java.util.List;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.junit.jupiter.api.BeforeEach;
22 import org.junit.jupiter.api.Test;
25 * Unit tests for {@link Device}.
27 * @author David Pace - Initial contribution
31 public class DeviceTest {
33 public static Device createTestDevice() {
34 Device device = new Device();
35 device.type = "device";
36 device.rootDeviceId = "64-da-a0-02-14-9b";
37 device.id = "hdm:HomeMaticIP:3014F711A00004953859F31B";
38 device.deviceServiceIds = Collections
39 .unmodifiableList(List.of("PowerMeter", "PowerSwitch", "PowerSwitchProgram", "Routing"));
40 device.manufacturer = "BOSCH";
41 device.roomId = "hz_3";
42 device.deviceModel = "PSM";
43 device.serial = "3014F711A00004953859F31B";
44 device.profile = "GENERIC";
45 device.name = "Coffee Machine";
46 device.status = "AVAILABLE";
50 private @NonNullByDefault({}) Device fixture;
54 fixture = createTestDevice();
59 assertTrue(Device.isValid(fixture));
63 public void testToString() {
65 "Type device; RootDeviceId: 64-da-a0-02-14-9b; Id: hdm:HomeMaticIP:3014F711A00004953859F31B; Device Service Ids: PowerMeter, PowerSwitch, PowerSwitchProgram, Routing; Manufacturer: BOSCH; Room Id: hz_3; Device Model: PSM; Serial: 3014F711A00004953859F31B; Profile: GENERIC; Name: Coffee Machine; Status: AVAILABLE; Child Device Ids: null ",