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.loxone.internal.controls;
15 import org.junit.jupiter.api.BeforeEach;
16 import org.junit.jupiter.api.Test;
17 import org.openhab.core.library.types.DecimalType;
18 import org.openhab.core.types.UnDefType;
21 * Test class for (@link LxControlInfoOnlyAnalog}
23 * @author Pawel Pieczul - initial contribution
26 public class LxControlInfoOnlyAnalogTest extends LxControlTest {
29 setupControl("0fec5dc3-003e-8800-ffff403fb0c34b9e", "0fe3a451-0283-2afa-ffff403fb0c34b9e",
30 "0fe665f4-0161-4773-ffff403fb0c34b9e", "Info Only Analog");
34 public void testControlCreation() {
35 testControlCreation(LxControlInfoOnlyAnalog.class, 2, 0, 1, 1, 1);
39 public void testChannels() {
40 testChannel("Number", null, null, null, null, "%.2f", true, null);
44 public void testLoxoneStateChanges() {
45 for (Double i = -1000.0; i < 1000.0; i += 33.7324323) {
46 changeLoxoneState("value", i);
47 testChannelState(new DecimalType(i));
49 changeLoxoneState("value", 0.0);
50 testChannelState(DecimalType.ZERO);
51 changeLoxoneState("value", Double.NaN);
52 testChannelState(UnDefType.UNDEF);
53 changeLoxoneState("value", Double.MAX_VALUE);
54 testChannelState(new DecimalType(Double.MAX_VALUE));
55 changeLoxoneState("value", Double.POSITIVE_INFINITY);
56 testChannelState(UnDefType.UNDEF);
57 changeLoxoneState("value", Double.MIN_VALUE);
58 testChannelState(new DecimalType(Double.MIN_VALUE));
59 changeLoxoneState("value", Double.NEGATIVE_INFINITY);
60 testChannelState(UnDefType.UNDEF);