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.paradoxalarm.internal;
15 import static org.junit.jupiter.api.Assertions.*;
17 import org.junit.jupiter.api.Test;
18 import org.openhab.binding.paradoxalarm.internal.util.ParadoxUtil;
21 * The {@link TestParadoxUtil} This test tests various functions from ParadoxUtils class
23 * @author Konstantin Polihronov - Initial contribution
25 public class TestParadoxUtil {
28 public void testExtendArray() {
29 byte[] arrayToExtend = { 0x0A, 0x50, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x59 };
31 byte[] extendedArray = ParadoxUtil.extendArray(arrayToExtend, rate);
33 final byte[] EXPECTED_RESULT = { 0x0A, 0x50, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x59, (byte) 0xEE, (byte) 0xEE,
34 (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE };
35 assertArrayEquals(EXPECTED_RESULT, extendedArray); //
39 public void testMergeArrays() {
40 final byte[] ARR1 = { 0x01, 0x02, 0x03 };
41 final byte[] ARR2 = { 0x04, 0x05, 0x06 };
42 final byte[] ARR3 = { 0x07, 0x08, 0x09 };
43 byte[] mergedArrays = ParadoxUtil.mergeByteArrays(ARR1, ARR2, ARR3);
45 final byte[] EXPECTED_RESULT = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
46 assertArrayEquals(EXPECTED_RESULT, mergedArrays);