]> git.basschouten.com Git - openhab-addons.git/blob
aa8249a3ef3e2155a04bc2203c06ff9edc0c1568
[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.rfxcom.internal.messages;
14
15 import static org.openhab.binding.rfxcom.internal.RFXComTestHelper.thingUID;
16 import static org.openhab.binding.rfxcom.internal.messages.RFXComBaseMessage.PacketType.CURTAIN1;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.junit.jupiter.api.Test;
20 import org.openhab.binding.rfxcom.internal.RFXComBindingConstants;
21 import org.openhab.binding.rfxcom.internal.RFXComTestHelper;
22 import org.openhab.binding.rfxcom.internal.config.RFXComGenericDeviceConfiguration;
23 import org.openhab.binding.rfxcom.internal.exceptions.RFXComException;
24 import org.openhab.core.library.types.OpenClosedType;
25 import org.openhab.core.thing.ChannelUID;
26
27 /**
28  * Test for RFXCom-binding
29  *
30  * @author Martin van Wingerden - Initial contribution
31  */
32 @NonNullByDefault
33 public class RFXComCurtain1MessageTest {
34     private static ChannelUID shutterChannelUID = new ChannelUID(thingUID, RFXComBindingConstants.CHANNEL_SHUTTER);
35     private static RFXComGenericDeviceConfiguration config = new RFXComGenericDeviceConfiguration();
36
37     static {
38         config.deviceId = "1.2";
39         config.subType = RFXComCurtain1Message.SubType.HARRISON.toString();
40     }
41
42     @Test
43     public void checkForSupportTest() throws RFXComException {
44         RFXComMessageFactoryImpl.INSTANCE.createMessage(CURTAIN1, config, shutterChannelUID, OpenClosedType.OPEN);
45     }
46
47     @Test
48     public void basicBoundaryCheck() throws RFXComException {
49         RFXComCurtain1Message message = (RFXComCurtain1Message) RFXComMessageFactoryImpl.INSTANCE
50                 .createMessage(CURTAIN1, config, shutterChannelUID, OpenClosedType.OPEN);
51
52         RFXComTestHelper.basicBoundaryCheck(CURTAIN1, message);
53     }
54
55     // TODO please add tests for real messages
56 }