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.bluetooth.radoneye;
15 import static org.junit.jupiter.api.Assertions.*;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.junit.jupiter.api.Test;
21 import org.openhab.binding.bluetooth.radoneye.internal.RadoneyeDataParser;
22 import org.openhab.binding.bluetooth.radoneye.internal.RadoneyeParserException;
25 * Tests {@link RadoneyeParserTest}.
27 * @author Peter Obel - Initial contribution
30 public class RadoneyeParserTest {
33 public void testEmptyData() {
35 assertThrows(RadoneyeParserException.class, () -> RadoneyeDataParser.parseRd200Data(data));
39 public void testWrongDataLen() throws RadoneyeParserException {
40 int[] data = { 1, 55, 51, 0, 122, 0, 61, 0, 119, 9, 11, 194, 169, 2, 46, 0, 0 };
41 assertThrows(RadoneyeParserException.class, () -> RadoneyeDataParser.parseRd200Data(data));
45 public void testParsingRd200() throws RadoneyeParserException {
46 int[] data = { 80, 16, 31, -123, 43, 64, 123, 20, 94, 64, 92, -113, -118, 64, 15, 0, 12, 0, 0, 0 };
47 Map<String, Number> result = RadoneyeDataParser.parseRd200Data(data);
49 assertEquals(99, result.get(RadoneyeDataParser.RADON).intValue());