]> git.basschouten.com Git - openhab-addons.git/blob
b40624e8d0cad689c17da458d343ff032225fa7b
[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.boschindego.internal;
14
15 import static org.hamcrest.CoreMatchers.*;
16 import static org.hamcrest.MatcherAssert.assertThat;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.junit.jupiter.api.Test;
20 import org.openhab.binding.boschindego.internal.dto.DeviceCommand;
21
22 /**
23  * Unit tests for {@link DeviceStatus}.
24  * 
25  * @author Jacob Laursen - Initial contribution
26  */
27 @NonNullByDefault
28 public class DeviceStatusTest {
29     @Test
30     public void unknownIdleStateHasReturnCommand() {
31         assertThat(DeviceStatus.fromCode(256).getAssociatedCommand(), is(DeviceCommand.RETURN));
32     }
33
34     @Test
35     public void unknownMowStateHasReturnCommand() {
36         assertThat(DeviceStatus.fromCode(520).getAssociatedCommand(), is(DeviceCommand.MOW));
37     }
38
39     @Test
40     public void unknownReturnStateHasReturnCommand() {
41         assertThat(DeviceStatus.fromCode(777).getAssociatedCommand(), is(DeviceCommand.RETURN));
42     }
43
44     @Test
45     public void chargingIsCharging() {
46         assertThat(DeviceStatus.fromCode(257).isCharging(), is(true));
47     }
48
49     @Test
50     public void dockedLoadingMapIsActive() {
51         assertThat(DeviceStatus.fromCode(262).isActive(), is(true));
52     }
53
54     @Test
55     public void lawnCompleteIsCompleted() {
56         assertThat(DeviceStatus.fromCode(775).isCompleted(), is(true));
57     }
58 }