]> git.basschouten.com Git - openhab-addons.git/blob
d254857b6b18c3a12dcf8a09703f6bbef6367ef8
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.bluetooth.am43;
14
15 import static org.junit.jupiter.api.Assertions.*;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.junit.jupiter.api.Test;
19 import org.openhab.binding.bluetooth.am43.internal.command.ControlCommand;
20 import org.openhab.binding.bluetooth.am43.internal.command.GetAllCommand;
21 import org.openhab.binding.bluetooth.am43.internal.data.ControlAction;
22 import org.openhab.core.util.HexUtils;
23
24 /**
25  *
26  * @author Connor Petty - Initial contribution
27  */
28 @NonNullByDefault
29 public class CommandTest {
30
31     @Test
32     public void findAllCommandTest() {
33         byte[] expected = HexUtils.hexToBytes("00ff00009aa701013d");
34         byte[] actual = new GetAllCommand().getRequest();
35         assertArrayEquals(expected, actual);
36     }
37
38     @Test
39     public void controlStopCommandTest() {
40         byte[] expected = HexUtils.hexToBytes("00ff00009a0a01cc5d");
41         byte[] actual = new ControlCommand(ControlAction.STOP).getRequest();
42
43         assertArrayEquals(expected, actual);
44     }
45
46     @Test
47     public void controlOpenCommandTest() {
48         byte[] expected = HexUtils.hexToBytes("00ff00009a0a01dd4c");
49         byte[] actual = new ControlCommand(ControlAction.OPEN).getRequest();
50
51         assertArrayEquals(expected, actual);
52     }
53 }