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
14 package org.openhab.binding.nobohub.internal.model;
16 import static org.junit.jupiter.api.Assertions.assertEquals;
17 import static org.junit.jupiter.api.Assertions.assertFalse;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.junit.jupiter.api.Test;
23 * Unit tests for Component model object.
25 * @author Jørgen Austvik - Initial contribution
28 public class ComponentTest {
30 public void testParseH02() throws NoboDataException {
31 Component comp = Component.fromH02("H02 186170024143 0 Kontor 0 1 -1 -1");
32 comp.setTemperature(12.3);
33 assertEquals(new SerialNumber("186170024143"), comp.getSerialNumber());
34 assertEquals("Kontor", comp.getName());
35 assertEquals(1, comp.getZoneId());
36 assertEquals(-1, comp.getTemperatureSensorForZoneId());
37 assertFalse(comp.inReverse());
38 assertEquals(12.3, comp.getTemperature(), 0.1);
42 public void testGenerateU03() throws NoboDataException {
43 Component comp = Component.fromH02("H02 186170024143 0 Kontor 0 1 -1 -1");
44 assertEquals("U02 186170024143 0 Kontor 0 1 -1 -1", comp.generateCommandString("U02"));