]> git.basschouten.com Git - openhab-addons.git/blob
17020c8dd7597b61dbc6a6de68e31696c1bf5aa4
[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.caddx.internal.message;
14
15 import static org.junit.jupiter.api.Assertions.*;
16
17 import java.util.Arrays;
18 import java.util.List;
19
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.junit.jupiter.params.ParameterizedTest;
22 import org.junit.jupiter.params.provider.MethodSource;
23 import org.openhab.binding.caddx.internal.CaddxMessage;
24 import org.openhab.binding.caddx.internal.CaddxMessageReaderUtil;
25
26 /**
27  * Test class for CaddxMessage.
28  *
29  * @author Georgios Moutsos - Initial contribution
30  */
31 @NonNullByDefault
32 public class CaddxMessageParseTest {
33
34     // @formatter:off
35     public static final List<Object[]> data() {
36         return Arrays.asList(new Object[][] {
37             { "zone_status_message", "zone_number", "4", },
38             { "interface_configuration_message", "panel_firmware_version", "5.37", },
39             { "interface_configuration_message", "panel_interface_configuration_message", "true", },
40
41         });
42     }
43     // @formatter:on
44
45     @ParameterizedTest
46     @MethodSource("data")
47     public void testParsing(String messageName, String property, String value) {
48         CaddxMessage message = CaddxMessageReaderUtil.readCaddxMessage(messageName);
49
50         assertNotNull(message, "Should not be null");
51         assertEquals(value, message.getPropertyById(property), property + " should be: " + value);
52     }
53 }