]> git.basschouten.com Git - openhab-addons.git/blob
a8b232664d969041e0ccef328dd958ef2bef42ca
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 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 org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.junit.Assert;
17 import org.junit.Test;
18 import org.openhab.binding.bluetooth.am43.internal.command.ControlCommand;
19 import org.openhab.binding.bluetooth.am43.internal.command.GetAllCommand;
20 import org.openhab.binding.bluetooth.am43.internal.data.ControlAction;
21 import org.openhab.core.util.HexUtils;
22
23 /**
24  *
25  * @author Connor Petty - Initial contribution
26  */
27 @NonNullByDefault
28 public class CommandTest {
29
30     @Test
31     public void findAllCommandTest() {
32         byte[] expected = HexUtils.hexToBytes("00ff00009aa701013d");
33         byte[] actual = new GetAllCommand().getRequest();
34         Assert.assertArrayEquals(expected, actual);
35     }
36
37     @Test
38     public void controlStopCommandTest() {
39         byte[] expected = HexUtils.hexToBytes("00ff00009a0a01cc5d");
40         byte[] actual = new ControlCommand(ControlAction.STOP).getRequest();
41
42         Assert.assertArrayEquals(expected, actual);
43     }
44
45     @Test
46     public void controlOpenCommandTest() {
47         byte[] expected = HexUtils.hexToBytes("00ff00009a0a01dd4c");
48         byte[] actual = new ControlCommand(ControlAction.OPEN).getRequest();
49
50         Assert.assertArrayEquals(expected, actual);
51     }
52 }