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.netatmo.internal.api;
15 import static org.junit.jupiter.api.Assertions.assertEquals;
16 import static org.openhab.binding.netatmo.internal.utils.ChannelTypeUtils.toQuantityType;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.junit.jupiter.api.Test;
20 import org.openhab.binding.netatmo.internal.api.data.NetatmoConstants.MeasureClass;
21 import org.openhab.core.types.State;
24 * @author Gaël L'hopital - Initial contribution
27 public class MeasureTest {
30 public void testMeasurePrecision() {
31 State value = toQuantityType(25.0, MeasureClass.INSIDE_TEMPERATURE);
32 assertEquals("25 °C", value.toString());
33 value = toQuantityType(52.0, MeasureClass.INSIDE_TEMPERATURE);
34 assertEquals("50 °C", value.toString());
35 value = toQuantityType(-10.0, MeasureClass.INSIDE_TEMPERATURE);
36 assertEquals("0 °C", value.toString());