]> git.basschouten.com Git - openhab-addons.git/blob
6804db4f1cea92107ecbb19f5fc47f896d23f186
[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.vdr.internal;
14
15 import static org.junit.jupiter.api.Assertions.assertEquals;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.junit.jupiter.api.Test;
19 import org.openhab.binding.vdr.internal.svdrp.SVDRPException;
20 import org.openhab.binding.vdr.internal.svdrp.SVDRPTimerList;
21
22 /**
23  * Specific unit tests to check if {@link SVDRPTimerList} parses SVDRP responses correctly
24  *
25  * @author Matthias Klocke - Initial contribution
26  *
27  */
28 @NonNullByDefault
29 public class SVDRPTimerListTest {
30     private final String timerListResponseTimerActive = """
31             1 1:1:2021-01-12:2013:2110:50:99:Charité (1/6)~Eiserne Lunge:Test
32             2 9:1:2021-01-12:2058:2200:50:99:Charité (2/6)~Blutsauger:Test\
33             """;
34     private final String timerListResponseTimerNotActive = """
35             1 1:1:2021-01-12:2013:2110:50:99:Charité (1/6)~Eiserne Lunge:Test
36             2 1:1:2021-01-12:2058:2200:50:99:Charité (2/6)~Blutsauger:Test\
37             """;
38
39     @Test
40     public void testParseTimerList() throws SVDRPException {
41         SVDRPTimerList list = SVDRPTimerList.parse(timerListResponseTimerActive);
42         assertEquals(true, list.isRecordingActive());
43         list = SVDRPTimerList.parse(timerListResponseTimerNotActive);
44         assertEquals(false, list.isRecordingActive());
45     }
46 }